httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joost Schuttelaar <>
Subject [users@httpd] htaccess and httpd.conf precedence (mod_deflate)
Date Tue, 01 Jun 2010 16:12:43 GMT
Hi everybody,

I'm running a Apache installation using a standard DirectAdmin setup, but I'm having problems
with handling of gzipped output.

One of my PHP scripts outputs a .ZIP file (with appropriate headers). By default, the output
of this script gets gzipped by mod_deflate. Of course there is no need to gzip a zip file,
but decent browsers have no problem handling this. Internet Explorer mangles the file though,
unless you set a non standard content type.

So, in order to fix this and disable gzip for this script, I've set up a line in my .htaccess

SetEnvIf Request_URI download_file\.php$ no-gzip dont-vary

When I test this using wget (wget --header="Accept-Encoding: gzip,deflate") this works fine.
Output from this script does not get gzipped. However, if I add the IE user agent header (User-Agent:
Mozilla/4.0 (compatible; MSIE 6.0;.....) the content still gets gzipped.

Strangely, when I replace the above line with 'SetEnv no-gzip', the content does not get gzipped
even though I send the IE user agent header. I've traced this back to the stock httpd-deflate.conf
which is included in my httpd.conf. It contains the following line:

BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

When I comment this line out, things work as expected... does, for some reason, a BrowserMatch
reffered from httpd.conf have precedence over what's in a .htaccess file? Any suggestions?
I could change my httpd.conf, but when the site for instance gets moved to a different server
this problem might rear it's ugly head again...



Joost Schuttelaar
The Hague, NL

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message