Webmasters Stack Exchange is a question and answer site for pro webmasters. 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

I want to disable gzip compression in my site using htaccess.

I have the code below in htaccess:

php_flag zlib.output_compression off

But it is not working.

share|improve this question
How is gzip compression currently implemented on your site? Do you wish to disable compression for the whole site, or just certain files? – w3dk May 1 '14 at 9:17
up vote 4 down vote accepted

Check here: http://stackoverflow.com/questions/9249243/how-to-disable-apache-gzip-compression-for-some-media-files-in-htaccess-file

It's possible, but looks like it will disable gzip for the whole website.

Keep in mind that you are telling PHP not to gzip, but Apache may still be gzipping so this should sort it, but check Apache config.

RewriteRule ^(.*)$ $1 [NS,E=no-gzip:1,E=dont-vary:1]
share|improve this answer
In the linked question, "global" refers to the whole site, not "every site hosted on [the] server" - if that is what you were referring to? – w3dk May 1 '14 at 9:26
thanks for reply – Amit Bera May 1 '14 at 10:09
@w3d Your right on that one. I'll update answer. – Clarkey May 1 '14 at 12:11

A simpler one that also works:
SetEnv no-gzip 1

The line you were using disables PHP's compression. The no-gzip env variable, on the other hand, disables Apache compression.

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.