Skip to content

Instantly share code, notes, and snippets.

@pcalves
Created March 11, 2015 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcalves/1818615afad4b5f3d5a8 to your computer and use it in GitHub Desktop.
Save pcalves/1818615afad4b5f3d5a8 to your computer and use it in GitHub Desktop.
Tells the server to ignore numbers in JavaScript and CSS file names (e.g. main.20150101.css), but the browser will still interpret it as a new file whenever the number is updated.
# cache-busting via file name
# Filename example:
# <link rel="stylesheet" href="/css/main.20150310.css">
# h/t Jeremy Keith (https://adactio.com/journal/8504)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.).(d).(js|css)$ $1.$3 [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment