michaelespinosa
michaelespinosa

Reputation: 511

How to disable the DEFLATE module for a specific directory?

I am trying to figure out how to disable the DEFLATE module (gzipping) for a specific directory on my server. This is what I have in /etc/httpd/conf/httpd.conf

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

I can add something to my .htaccess file in the specific directory or even add a something to my /vhosts/domain.com/httpdocs/conf/vhosts.conf file. I can't seem to get it to work though. Any suggestions?

Upvotes: 3

Views: 6541

Answers (2)

jeteon
jeteon

Reputation: 3719

Another way to accomplish this is to put the following line in a .htaccess file in the target directory:

 SetEnv no-gzip 1

It worked for me when the GZIP was causing issues with mod_substitute.

Upvotes: 3

michaelespinosa
michaelespinosa

Reputation: 511

I removed my original code from /etc/httpd/conf/httpd.conf and added this to my vhost.conf on this domain

<Directory "/var/www/rockchurch.com/httpdocs">
AddOutputFilterByType DEFLATE html txt xml css js php
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

php_admin_value open_basedir none
php_admin_value safe_mode off
Options FollowSymLinks
</Directory>

<Directory "/var/www/rockchurch.com/httpdocs/tiny">
RemoveOutputFilter DEFLATE html txt xml css js php
</Directory>

And works well. Apparently having it in /etc/httpd/conf/httpd.conf universally adds it to all domains, which is great, but can't be changed in specific directories elsewhere.

Upvotes: 4

Related Questions