I am keen to obtain began experimentation with gzip, but like i did previously find php.internet initially when i first began learning php, the apache documentation atmosphere me a little. http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
I'd really appreciate an example htaccess file to take a look at if anyone's got one?
Are also there things that ought to be transformed within the httpd.conffile rather than htaccess if I am enabling gzipping server-wide?
Sorry i am a newb with apache!
and so i enable mod_deflate within the httpd.conf after which putting the next into an ht access file works (for example)?
<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 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>
You are able to enable gzip in both Apache, with mod_deflate or with PHP. The module itself should be triggered in Apache's primary config file, if you can choose which files are compressed on the per-directory basis using .htaccess files (unless of course the primary configuration prohibits with
AllowOverride None or similar). The hyperlink you incorporated provides good examples.
You may also enable it only in PHP with the addition of
zlib.output_compression = On for your php.ini file.