Wednesday, 23 November 2011

Apache htaccess - Compressing JS CSS and the lot

In Apache there are modules, gzip, and deflate, these are tools for compression.
Gzip only compresses html where as deflate compresses the file that you specify.
High end community sites like www.royalchallengers.com, ihealthu.com uses this feature.

Please add this to htaccess :
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
    # file-types indicated will not be compressed
SetEnvIfNoCase Request_URI \.(?:rar|zip|pdf|swf)$ no-gzip dont-vary
    <IfModule mod_headers.c>
        Header append Vary User-Agent
    </IfModule>
</IfModule> 


Use this url to test the results http://www.gidnetwork.com/tools/gzip-test.php

No comments:

Post a Comment