Forked from stopspazzing/leverage browser caching in .htaccess
Created
January 8, 2017 18:02
-
-
Save garrettcadams/adbb66edb3303723c34be8240dd30313 to your computer and use it in GitHub Desktop.
This file contains 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
# Turn on Expires and set default to 0 | |
ExpiresActive On | |
ExpiresDefault A0 | |
# Set up caching on media files for 1 year (forever?) | |
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> | |
ExpiresDefault A29030400 | |
Header append Cache-Control "public" | |
</FilesMatch> | |
# Set up caching on media files for 1 week | |
<FilesMatch "\.(gif|jpg|jpeg|png|swf)$"> | |
ExpiresDefault A604800 | |
Header append Cache-Control "public" | |
</FilesMatch> | |
# Set up 2 Hour caching on commonly updated files | |
<FilesMatch "\.(xml|txt|html|js|css)$"> | |
ExpiresDefault A604800 | |
Header append Cache-Control "proxy-revalidate" | |
</FilesMatch> | |
# Force no caching for dynamic files | |
<FilesMatch "\.(php|cgi|pl|htm)$"> | |
ExpiresActive Off | |
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" | |
Header set Pragma "no-cache" | |
</FilesMatch> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment