Forum Moderators: phranque
My host uses Apache 2.2.10 so I think I need to use mod_deflate to compress all my files.
In phpinfo() I have:
_SERVER["HTTP_ACCEPT_ENCODING"]gzip,deflate
so it looks like the modules are enabled.
in my .htaccess in the public_html directory I have
# Compress output
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-php
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
When I load up my site with [websiteoptimization.com...]
it shows that the main file index.php is being compressed but says that the css file and a bunch of js files remain uncompressed.
Theses files are of course hosted on my server but are not in the root directory. For instance the .css file is in public_html/images/main.css
Is there something extra I should be doing to get it to compress the css file?
AddFilterByType only "cares" about the filetype (the physical file's extension). It does not care about the requested URL, the directory path to the file, or the file's name, it only cares about its extension. Therefore, your .css files should be getting compressed if the client indicates that it can accept gzip compression on .css files.
Jim