Skip to content

Instantly share code, notes, and snippets.

@skojin
Created February 26, 2010 14:43
Show Gist options
  • Save skojin/315760 to your computer and use it in GitHub Desktop.
Save skojin/315760 to your computer and use it in GitHub Desktop.
set expire header for images/assets that have version info in query string, apache conf
# mark versioned assets
RewriteCond %{REQUEST_URI} ^/(images|stylesheets|javascripts)/.*\.(css|js|jpe?g|png|gif|ico)$
RewriteCond %{QUERY_STRING} ^[0-9]+$
RewriteRule ^.*$ $0 [E=IS_VERSIONED_ASSET:true,L]
# expire them in future
Header onsuccess set "Cache-Control" "max-age=31536000" env=IS_VERSIONED_ASSET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment