Created
May 24, 2011 13:32
-
-
Save dave1010/988704 to your computer and use it in GitHub Desktop.
mod_rewrite filename-123.css to filename.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# only for files / directories that don't exist | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
# remove "-" and any digits preceding a file extension | |
RewriteRule ^(.*)\-[0-9]+(\.[a-z]+)$ $1$2 [L] | |
# works for CSS, JS, images, etc. | |
# means you can set far-future expires headers (so browsers cache files lots) | |
# whilst being able to easily invalidate the cache, just by changing the version number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment