Skip to content

Instantly share code, notes, and snippets.

@skreuzer
Created May 27, 2014 20:36
Show Gist options
  • Save skreuzer/7c388b939c5f4b5a8d5e to your computer and use it in GitHub Desktop.
Save skreuzer/7c388b939c5f4b5a8d5e to your computer and use it in GitHub Desktop.
# Cache images for one month
<FilesMatch ".(gif|jpg|jpeg|png|ico)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
# Cache text, CSS, and javascript files for one week
<FilesMatch ".(js|css|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
# Cache HTML files for one day
<FilesMatch ".(html|htm)$">
Header set Cache-Control "max-age=43200"
</FilesMatch>
# Explicitly disable caching for scripts and other dynamic files
<FilesMatch "\.(pl|php|cgi)$">
Header unset Cache-Control
</FilesMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment