Enable HTTP compression for Apache HTTP SERVER

By admin - Last updated: Saturday, December 20, 2008 - Save & Share - Leave a Comment

Edit httpd.conf to enable compression for Apache HTTP server
Most likely, it is under

C:\Program Files\Apache Software Foundation\Apache2.x\conf\httpd.conf

Copy and Past the following to the bottom of the file and restart Apache.

LoadModule deflate_module modules/mod_deflate.so

<IfModule mod_deflate.c>
        #DeflateCompressionLevel 9
        <Location />
                AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml
                <IfModule mod_headers.c>
                        Header append Vary User-Agent
                </IfModule>
        </Location>
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
</IfModule>

HTTP header “Vary User-Agent” and the “BrowserMatch” indicate that the compression decision is made on the type/version of the browser, the rules have been configured at BrowserMatch.

For example,

BrowserMatch ^Mozilla/4 gzip-only-text/html
Netscape 4.x has some problems with decompressing content with content-type other than text/html.




Posted in Apache • Tags: , , Top Of Page

Write a comment


Captcha: 4 − one =