Created
September 25, 2015 18:10
-
-
Save jonathanstark/163ac0d0891aa9d6d85c to your computer and use it in GitHub Desktop.
Caching stuff for Apache .htaccess file
This file contains hidden or 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
##### CACHING STUFF ##### | |
# 1 YEAR | |
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> | |
Header set Cache-Control "max-age=31536000, public" | |
</FilesMatch> | |
# 1 WEEK | |
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> | |
Header set Cache-Control "max-age=604800, public" | |
</FilesMatch> | |
# 3 HOUR | |
<FilesMatch "\.(txt|xml|js|css)$"> | |
Header set Cache-Control "max-age=10800" | |
</FilesMatch> | |
# NEVER CACHE - notice the extra directives | |
<FilesMatch "\.(html|htm|php|cgi|pl)$"> | |
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate" | |
</FilesMatch> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment