Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

The site in question is

I've got a basic shared hosting account and my website is a little heavy on the javascript so I decided to compress with gzip.

Contacted my hosting, they say that Apache on the server has mod_gzip enabled.

So I added the following to my local .htaccess (don't have access to the global).

<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

Compression doesn't seem to work (I test with

I tried adding php_value output_handler ob_gzhandler To compress through php only, but still no dice. I also tried deflate with no luck..

Might someone hint me about what I'm doing wrong?

share|improve this question

Are you sure the server is actually loading the .htaccess? A quick test I usually do is throw some garbage text in there. If Apache starts producing 500's, you can be sure it's actually being used.

mod_gzip is actually pretty uncommon. Are you sure they weren't talking about mod_deflate? Try enabling that instead:

share|improve this answer

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.