Can't remember where I learned this but it is fairly common and works wonders. In case you have not heard of it in the past, Gzip is a server process that essentially compresses your files on the fly before transmission to the user. It is primarily used to compress text files such as HTML, CSS, and JavaScript with impressive results. Take the 90KB Mootools framework for example, Gzip reduces it to 26KB saving the visitor time and your bandwidth.

#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
#End Gzip

Usage

This code can most likely be placed anywhere in the .htaccess file. I like to put it below the Rewrite conditions and above the Expires for organizational purposes. Note that the If statements are really only needed if you are unsure that your host has it enabled or not.

Pros

  • Drastic file size reduction, need I say 26KB is less than 90KB more than once?
  • Great for mobile users (where every KB counts).
  • Easy to implement in the .htaccess file.
  • Saves bandwidth.

Cons

  • Increased server load.
  • Not enabled by default on most shared servers.

Recommendation

If your hosting setup has Gzip enabled I highly recommend that you enable it in your .htaccess file by copying and pasting the above code into your .htaccess. If they don't have it enabled, simply ask, most of the time they will simply enable it for you. It also comes recommended by Google and Yahoo.


Hosted By:

SkyToaster, Simple Quality Hosting