Update
Well in the end I couldn’t get this to work. Too noob. So I’ve settled on old school versioning. Not really an issue in the end as the extra overhead (working on a duplicated and renamed the CSS file) is no big deal.
KISS.
CSS caching was an issue waiting to jump out at me. In the end it’s covered.
.htaccess
has whooped my ass again – but I’ll be back.
Great tip from Ask Apache. This one is a couple of tips down from here. A real beauty. Imagine working on a live site – you’re just updating your CSS – but this is cached. Now you change the include file which has your HTML head calling yours CSS file. Bingo – site-wide updated CSS. Brilliant.
Pasted here for posterity.
Cache-Friendly File Names
This is probably my favorite, and I use it on every site I work on. It allows me to update my javascript and css files in my visitors cache’s simply by naming them differently in the html, on the server they stay the same name. This rewrites all files for
/zap/j/anything-anynumber.js to /zap/j/anything.js and /zap/c/anything-anynumber.css to /zap/c/anything.css
RewriteRule ^zap/(j|c)/([a-z]+)-([0-9]+).(js|css)$ /zap/$1/$2.$4 [L]
Last updated on 5th September 2018
Leave a Reply