I'm trying to implement a poor man's substitute to mod_gzip since my provider refuses to turn it on, and I'm having some problems doing it with mod_rewrite. I saved my scripts in the scripts directory. I put gz-compressed copies in the scripts/compressed directory.
I've found that when I request the script directly, I get the compressed file; but when the browser requests it through my page in /, I get the original uncompressed script. The addresses used in both are exactly the same.
I'd appreciate any ideas. This has me stumped.
Scripts/.htaccess
- Code: Select all
RewriteEngine on
RewriteBase /scripts
RewriteCond %{HTTP_USER_AGENT} "MSIE 7|Firefox"
RewriteCond %{HTTP_ACCEPT} >gzip
RewriteRule ^(.+).js$ compressed/$1.js.gz [QSA,L]
Scripts/Compressed/.htaccess
- Code: Select all
ForceType text/javascript
Header set Content-Encoding: gzip
Thanks in advance,
Wesley