How to force the browser to reload cached CSS/JS files?

后端 未结 30 4356
青春惊慌失措
青春惊慌失措 2020-11-21 05:49

I have noticed that some browsers (in particular, Firefox and Opera) are very zealous in using cached copies of .css and .js files, even be

30条回答
  •  灰色年华
    2020-11-21 05:54

    The RewriteRule needs a small update for js or css files that contain a dot notation versioning at the end. E.g. json-1.3.js.

    I added a dot negation class [^.] to the regex so .number. is ignored.

    RewriteRule ^(.*)\.[^.][\d]+\.(css|js)$ $1.$2 [L]
    

提交回复
热议问题