Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 \.(?:gif|jpe?g|png)$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        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
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.