YSlow and Compress Components with GZip

With the Firebug add-on YSlow, one of the components that gets rated is something called Compress components with gzip. When you run YSlow to optimize your website or blog, you may be getting dinged on that component. Here is how to improve your site’s speed a bit – with two huge caveats:

  1. You web server must be running Apache 1.3
  2. Your Apache 1.3 must use mod_gzip

If those two items are true, then to set up gzip compression, paste the following into you .htaccess file**.

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate Yes
mod_gzip_add_header_count Yes
mod_gzip_send_vary Yes
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_min_http 1000
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 512000
mod_gzip_maximum_inmem_size 60000
mod_gzip_handle_methods GET POST
mod_gzip_temp_dir /tmp
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.rb$
mod_gzip_item_include file \.py$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include file \.css$
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include handler ^application/x-httpd-php
mod_gzip_item_exclude mime ^image/.*
</IfModule>

If all goes well, you should now get an A for Compress components with gzip*.

*If you don’t get an A, it is likely due to the fact that you are calling in external files like JavaScripts, style sheets or images. If that’s the case, you are out of luck unless you have some control or influence over the external file.

**If you do not have an .htaccess file in you file system, you can create one. Simply create a file called “.htaccess” in your web root. Open the file in your favorite editor and paste in the code above, save and close. Sometimes, the .htaccess file is hidden from view. If so, you may need to turn on a toggle for “Show Invisible Files” or something similar in you FTP application or Web File Browser.

How Can We Help You?

We want to build your next project.

Connect with Pixel Jar

Our Community

Subscribe to learn more about the goings on at Pixel Jar and AdSanity.
  • This field is for validation purposes and should be left unchanged.