![]() |
Preventing dynamically-served files from being gzipped (with clean URLs)
Hello,
I (and others) have come to realize that IE 6/7/8 will double-compress any already-compressed file -- and fail to double-de-compress it -- when gzip compression is enabled for, e.g., a ZIP file download. To work around this limitation, I need to have some means by which to exclude certain URLs from compression. On its face, this seems simple enough, but this particular application requires the use of so-called "clean URLs". As such, Apache's SetEnvIf module seems not to be able to access the "clean URL"; it always sees "/index.php" for the "Request_URI". I have this mod_rewrite rule: Code:
# Rewrite URLs of the form 'index.php?q=x':Code:
SetEnvIfNoCase Request_URI (.*)(/|download/.*)$ no-gzip dont-varyThe problem is that the SetEnvIf directive is never satisfied because, as stated above, Request_URI always equals the "true" URI, as it exists before the clean URL" rewriting is performed: "/index.php". I considered using mod_rewrite to modify the CGI environment variables, but I don't like that solution because a) it very likely wouldn't work when PHP is running under Mod-PHP (as opposed to Fast-CGI), it wouldn't work if SuPHP is in use, and it may not even be possible to modify the "no-gzip" environment variable; the Apache docs state: "It is not possible to override or change the standard CGI variables using the environment manipulation directives." Does anyone have any other ideas? EDIT to add: This kind of thing doesn't work, for the reasons outlined above: Code:
# Don't compress images (or other files that are already compressed) |
You can try this:
Code:
BrowserMatch ^Mozilla/4 gzip-only-text/html |
| All times are GMT +2. The time now is 00:47. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.