Forum Moderators: phranque
I tried this in my .htaccess file...
AddEncoding x-gzip .css
Not sure if that is how the syntax should look and I would please like some help clarifying how I should do this. I also came across issues regarding backwards compatibility. I'm server for Gecko 1.0+, IE 5.0+, and Opera 4.0+ (none of these require XHTML cloaking, just extra CSS includes) on the PC platform in case there are any issues I need to be made aware of with those browsers/version as far as handling compression is concerned. However I'm not worried about browsers outside that range on the PC platform. Thanks!
- John
Generally, you need to make sure the client can accept gzip encoding by checking the HTTP_ACCEPT_ENCODING header. If the client says it can accept the compressed format, then serve (rewrite to) stylesheet.css.gz instead of serving stylesheet.css.
Basically,
RewriteCond %{HTTP_ACCEPT_ENCODING} gzip
RewriteRule ^(([^.]+\.)+)css$ /$1css.gz [L]
Remember that the AddType directive works off the served filetype, so if you rewrite to stylesheet.css.gz, the URL is /stylesheet.css, the filename is stylesheet.css.gz, and the MIME type is application/x-gzip. If you don't do the rewrite, then the URL is /stylesheet.css, the filename is stylesheet.css and the MIME type is text/plain.
Jim
[Tue Jun 12 00:33:38 2007] [alert] [client 127.0.0.1]?:/../../../.htaccess: Invalid command 'RewriteCond', perhaps misspelled or defined by a module not included in the server configuration, referer: [localhost...]I'm running XAMPP and I haven't modified anything except for the path to the public folder.
- John