Take the 2-minute tour ×

I'm using the follow code in .htaccess. It works nicely in localhost, however in production server i'm having troubles with gzip compression.

AddOutputFilterByType DEFLATE text/css text/html application/x-javascript application/javascript <IfModule mod_deflate.c>
        SetOutputFilter DEFLATE
        SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html </IfModule>

I contacted my host provider and they told me that mod_deflate is loaded in apache and running. They provide me the following URL to server info. Could you please help me and see if it's in fact loaded? Is this information enough to determine that?

Thanks in advance, Pedro


share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Pedro -

Apache's mod_deflate and PHP's gzip compression are a bit different. If you want to do it via PHP (which it looks like you can do based on your phpinfo() page, you may want to check out this DevShed article. There's also the option to enable it in your php.ini for all of your PHP scripts automatically:

zlib.output_compression_level = 1

If you want to test to see if mod_deflate is working properly, load up the Live HTTP Headers extension in Firefox and see if the HTTP response from your server contains headers like this one:

Content-Encoding: gzip

My site has it enabled, so you can test against it as a reference.

share|improve this answer
I contacted my hosting company again and the problem was related with APACHE (mod_deflate wasn't loaded). It's working nicely now! Thanks for your help –  Pedro Gil Oct 13 '10 at 11:55
Woot! Glad to hear that it's resolved! –  majorhayden Oct 13 '10 at 18:20
add comment

Your Answer


