-
-
Save shospodarets/e3e253d666d63aff27422eb0e8720917 to your computer and use it in GitHub Desktop.
Apache GZIP compression and Expires headers
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
# BEGIN GZIP | |
# http://httpd.apache.org/docs/2.2/mod/mod_deflate.html | |
<IfModule mod_deflate.c> | |
# Enabling Compression | |
SetOutputFilter DEFLATE | |
# Insert filters | |
AddOutputFilterByType DEFLATE text/plain | |
AddOutputFilterByType DEFLATE text/html | |
AddOutputFilterByType DEFLATE text/xml | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE application/xml | |
AddOutputFilterByType DEFLATE application/xhtml+xml | |
AddOutputFilterByType DEFLATE application/rss+xml | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/x-javascript | |
AddOutputFilterByType DEFLATE application/x-httpd-php | |
AddOutputFilterByType DEFLATE application/x-httpd-fastphp | |
AddOutputFilterByType DEFLATE image/svg+xml | |
# Drop problematic browsers | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html | |
# Make sure proxies don't deliver the wrong content | |
Header append Vary User-Agent env=!dont-vary | |
</IfModule> | |
# END GZIP | |
# BEGIN Expires headers | |
<IfModule mod_expires.c> | |
# Enable expirations | |
ExpiresActive On | |
# Default directive | |
ExpiresDefault "access plus 1 month" | |
# My favicon | |
ExpiresByType image/x-icon "access plus 1 year" | |
# Images | |
ExpiresByType image/gif "access plus 1 month" | |
ExpiresByType image/png "access plus 1 month" | |
ExpiresByType image/jpg "access plus 1 month" | |
ExpiresByType image/jpeg "access plus 1 month" | |
# CSS | |
ExpiresByType text/css "access 1 month" | |
# Javascript | |
ExpiresByType application/javascript "access plus 1 year" | |
</IfModule> | |
# END Expires headers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment