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:
- a rewrite rule
SetEnv
/SetEnvIf
The latter is a better choice, as it won't be affected by other rewrite rules.
Use a Rewrite Rule in .htaccess
You can place the following in .htaccess
:
RewriteRule . - [E=no-gzip:1]
Be aware that other rewrite rules may affect it.
Use SetEnv/SetEnvIf in .htaccess
You can place the following in .htaccess
:
SetEnv no-gzip 1