I'm trying to enable Gzip on my webserver and am not succeeding. By all means, I should have by now, I've done it before but success is eluding me.
I have this in my httpd.conf
<Location "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/bt/web"> # 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>
And
<IfModule mod_deflate.c> <FilesMatch "\.(js|css|html|htm)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule>
mod_deflate is enabled.
What am I doing wrong?
The first issue is that you have the element with a directory from the file system...
This is from the Apache manual:
When to use
<Location>
. Use<Location>
to apply directives to content that lives outside the filesystem. For content that lives in the filesystem, use<Directory>
and<Files>
. An exception is<Location />
, which is an easy way to apply a configuration to the entire server.When I setup mod_deflate on Apache I use this setup: