Created
November 15, 2013 00:20
-
-
Save zztimur/7476923 to your computer and use it in GitHub Desktop.
Apache Expires module configuration for common set up, as well as server stored fonts.
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
# Add expire headers | |
# BEGIN Expires | |
<ifModule mod_expires.c> | |
ExpiresActive On | |
ExpiresDefault "access plus 0 seconds" | |
ExpiresByType text/html "access plus 2592000 seconds" | |
ExpiresByType image/gif "access plus 2592000 seconds" | |
ExpiresByType image/jpeg "access plus 2592000 seconds" | |
ExpiresByType image/png "access plus 2592000 seconds" | |
ExpiresByType image/jpg "access plus 2592000 seconds" | |
ExpiresByType image/vnd.microsoft.icon "access plus 2592000 seconds" | |
ExpiresByType image/x-icon "access plus 2592000 seconds" | |
ExpiresByType image/ico "access plus 2592000 seconds" | |
ExpiresByType text/css "access plus 2592000 seconds" | |
ExpiresByType text/javascript "access plus 2592000 seconds" | |
ExpiresByType text/javascript "access plus 2592000 seconds" | |
ExpiresByType application/x-javascript "access plus 2592000 seconds" | |
# Fonts | |
ExpiresByType application/font-woff "access plus 10 years" | |
ExpiresByType application/x-font-ttf "access plus 10 years" | |
ExpiresByType application/vnd.ms-fontobject "access plus 10 years" | |
ExpiresByType image/svg+xml "access plus 10 years" | |
ExpiresByType application/x-font-opentype "access plus 10 years" | |
# Archaic stuff... | |
ExpiresByType text/x-component "access plus 10 years" | |
</ifModule> | |
# END Expires | |
# 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 A29030400 | |
Header append Cache-Control "public" | |
</FilesMatch> | |
# Set up 2 Hour caching on commonly updated files | |
<FilesMatch "\.(xml|txt|html|js|css)$"> | |
ExpiresDefault A29030400 | |
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