Disable gzip Compression at the Virtual Host Level

Gzip compression can normally be enabled/disabled from the server level. However sometimes you may have to control the gzip compression for a particular virtual host through .htaccess without affecting the global settings. There are two ways to turn off gzip dynamically:

  1. a rewrite rule
  2. SetEnv/SetEnvIf

The latter is a better choice, as it won't be affected by other rewrite rules.

You can place the following in .htaccess:

RewriteRule . - [E=no-gzip:1]

Be aware that other rewrite rules may affect it.

You can place the following in .htaccess:

SetEnv no-gzip 1
  • Admin
  • Last modified: 2018/09/07 18:24
  • by Lisa Clarke