Return to Snippet

Revision: 15613
at July 11, 2009 22:15 by iloveitaly


Initial Code
# no weird non-ASCII quotes! Arg! They wasted an hour of time!
# info: http://www.bluehostforum.com/showthread.php?t=11402

Options +followsymlinks

<FilesMatch "\.js.gz$"> 
ForceType text/javascript 
Header set Content-Encoding: gzip 
</FilesMatch> 
<FilesMatch "\.js$"> 
RewriteEngine On 
RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
RewriteCond %{HTTP:Accept-Encoding} gzip 
RewriteCond %{REQUEST_FILENAME}.gz -f 
RewriteRule (.*)\.js$ $1\.js.gz [L] 
ForceType text/javascript 
</FilesMatch>

<FilesMatch "\.css.gz$"> 
ForceType text/css 
Header set Content-Encoding: gzip 
</FilesMatch> 
<FilesMatch "\.css$"> 
RewriteEngine On 
RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
RewriteCond %{HTTP:Accept-Encoding} gzip 
RewriteCond %{REQUEST_FILENAME}.gz -f 
RewriteRule (.*)\.css$ $1.css.gz [L]
ForceType text/css 
</FilesMatch>

Initial URL


Initial Description
Combine this with the my compression script and things load real fast. I think I pulled some of this code of a site on google... can't claim complete credit.

Initial Title
Optionally Serve Statically Compressed CSS & JS

Initial Tags
css, javascript, js, search, apache

Initial Language
Apache