Optimize Your Site Speed Part 1: Gzip Compression

by Thomas Griffin on June 30, 2010

Optimize Your Site Speed | SEO Blog Help

I am embarking on a new series entitled “Optimize Your Site Speed”. Each part will feature different areas in which you can improve the page load time on your website and/or blog. Because Google now uses site speed as a determining factor in your ranking positions, it is imperative that you do all that you can in order to boost the load time of your site. Today we will be talking about gzip compression.

What is Gzip Compression?

Gzip compression is a technique whereby the server that is loading your content sends over a compressed version of your page that is currently loading. You’ve seen zipped files before, and you have probably had to use some program to “unzip” them in order to bring out all the content. Before it is “unzipped”, all the content is hid away in a small little file. This is what the server does to your page content. Basically here’s how it all plays out:

–>Your browser sends out a request to your server that your content be compressed on its return
–>The server agrees to this request under your pre-specified conditions and zips up your content
–>The browser then thanks the server for the zipped file and unzips it for your visitors when the page loads

Such a nice thing to do, right? I would agree. Gzip compression can drastically reduce your page size (up to 75% ish) and optimize your site speed. It is something you definitely want to look into if you haven’t already implemented it on your blog yet.

Implementing Gzip Compression on Your Blog

Now for the dirty work. Let’s look at how we can implement gzip compression on your own blog.

*Note: You need to check with your hosting company to make sure that they allow the use of mod_deflate or mod_gzip (preferably mod_deflate – it works better). Many shared server hosting providers will not allow you to use this because of the extra CPU usage it consumes. You will need to call support and ask them if they allow it. If they do, ask them to activate it for you.

With .htaccess

Copy and paste this code into your .htaccess file:

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript

As long as the mod_deflate module has been uncommented on your server, your output will now be compressed in the gzip format. After placing this in your .htaccess, feel free to test your website for gzip compression here. If everything has been done correctly, you should see improved load times on all your pages.

With PHP

You can also use gzip compression by adding a line of php code to your header.php WordPress file. Copy this code and paste it at the top of your file (right below the introduction text):


This will also send your content compressed as long as the mod_gzip module has been loaded on your server. However, I would only recommend this if you can’t use mod_deflate because this way is not quite as efficient as through .htaccess.

And there you have it! You have now reduced your page size and consequently optimized your site speed for your visitors! Gzip compression is a wonderful thing, so if you haven’t implemented it yet, get crackin’!

Have any questions? Feel free to ask me in the comments section below!

Be Sociable, Share!
SEO Blog Help | SEO Blog Tips For Beginners This article was written by Thomas Griffin.
You digging this theme? Me too. You should probably look into buying it very soon. Perhaps now would be a good time. If you want your mad theme desires to be satisfied, purchase Thesis here.
No, really. Be satisfied.

Leave a Comment

Previous post: