
apache compression
By:
Pothi on
Jan 29th, 2012 | syntax:
None | size: 1.27 KB | hits: 58 | expires: Never
### Enable HTTP Compression
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images & favicon
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|ico)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>
ExpiresActive on
ExpiresDefault "access plus 5 weeks"
ExpiresByType image/jpg "access plus 8 weeks"
ExpiresByType image/gif "access plus 8 weeks"
ExpiresByType image/jpeg "access plus 8 weeks"
ExpiresByType image/png "access plus 8 weeks"
ExpiresByType text/css "access plus 8 weeks"
ExpiresByType text/javascript "access plus 8 weeks"
ExpiresByType application/javascript "access plus 8 weeks"
# HTML documents are good for a week from the time they were changed
ExpiresByType text/html M604800
### For favicon
AddType image/x-icon .ico
ExpiresByType image/x-icon "access plus 8 weeks"