Forum Moderators: phranque
Here is my .htaccess:
RewriteEngine onRewriteCond %{HTTP_HOST} !^www\.example\.net[/url] [NC]
RewriteRule ^(.*)$ http://www.example.net/$1 [R=301,L]RewriteRule ^user/([A-Za-z0-9@._-]+)/?$ profile.php?username=$1 [L]
RewriteRule ^buddies/([A-Za-z0-9@._-]+)/?$ buddies.php?username=$1 [L]
The mod_deflate settings I use are straight from the Apache Manual and work on pages that are not in the mod_rewrite set:
<Location />
# Insert filter
SetOutputFilter DEFLATE# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif¦jpe?g¦png)$ no-gzip dont-vary# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>
I tried doing some debugging, here are the results from the response headers.
http://www.example.net/phpinfo.php -> gzip encoded
[these next two are the same url in different forms]
www.example.net/user/givehimagun -> not encoded
www.example.net/profile.php?username=givehimagun -> gzip encoded
Online compression checkers report the same:
www.example.net/user/givehimagun -> not gziped
www.example.net/profile.php?username=givehimagun -> gziped
I tried messing with the <Location /> part of the mod_deflate but that just breaks things
If anyone could give me some help, I would greatly appreciate it. Thanks!
[edited by: jdMorgan at 2:11 am (utc) on April 16, 2006]
[edit reason] No URLS, please. See Terms of Service. [/edit]
One thing that is obvious is that the pages that do get compressed do not have the Transfer-encoding: Chunked header, while the ones without compression have that header.
I even forced a [R] flag on my mod_rewrite rules, but all that does is mask the problem by using the compressable (ultimately non-rewrote rules) to display, thus defeating the purpose of having nice rewrote urls.
I just don't get it...this thing is frustrating me.
I have FollowSymLinks if that matters, but I don't know what else could be affecting the rewrote urls and not affecting the others!