Skip to content

Instantly share code, notes, and snippets.

@markhowellsmead
Last active May 19, 2016 07:37
Show Gist options
  • Save markhowellsmead/4a8b6bec277bb903b5f9 to your computer and use it in GitHub Desktop.
Save markhowellsmead/4a8b6bec277bb903b5f9 to your computer and use it in GitHub Desktop.
CSS file versioning using htaccess file (Apache config)
# CSS file versioning using htaccess file (Apache config)
# Link to the file style.123456.css and the server will deliver style.css
# Change the number and the web browser will see it as a different file
# and force it to be loaded afresh
# permanenttourist.ch | mark@permanenttourist.ch | 6/2014 | Free use, no credit required
# Warning: use only numeric sequences for the version reference!
# Warning: if a file with the actual name really exists, it will be served!
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)\.[\d]+\.(css|js)$ $1.$2 [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment