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.

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


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.


  • 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.


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


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.