5

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.

  • 1
    How is gzip compression currently implemented on your site? Do you wish to disable compression for the whole site, or just certain files? – MrWhite May 1 '14 at 9:17
7

Check here: https://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]
  • 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? – MrWhite May 1 '14 at 9:26
  • @w3d Your right on that one. I'll update answer. – Clarkey May 1 '14 at 12:11
6

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.

  • Note that you need to enable apache module 'env' for this to work. – Crypt0 Jun 13 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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