Now the following will not help you with files that are already cached, but moving forward, you can use the following to simplify the request for something new without changing the file name.
# Rewrite all requests for JS and CSS files to files of the same name, without
Of course, the higher you take this approach in your folder structure, the more you throw things out of the cache with a simple change.
So, for example, if you store all the css and javascript of your site in one main folder
/assets/js /assets/css /assets/...
Then you can start referring to it as "assets-XXX" in your html and use such a rule to knock out all the contents of the resources from the cache.
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^assets-([a-z0-9]+)/(.*) /$2 [R=302,NC,L] </IfModule>
Note that if you do this, after you earn it, change the value of 302 to 301, and then start caching. When it is 302, it will not cache at the browser level, because it is a temporary redirect. If you do this, then you can increase the expiration time to 30 days for all assets, since you can easily throw things out of the cache by simply changing the name of the folder on the login page.
<IfModule mod_expires.c> ExpiresActive on ExpiresDefault A2592000 </IfModule>
Brad Parks Jul 18 '17 at 12:50 2017-07-18 12:50
source share