1 Incredibly Wicked Trick To Speeding Up Your Blog’s Load Time

by John Hoff on September 6, 2009

We all know attention spans on the Web are small. Make a potential first time visitor to your site wait more than a few moments for your blog to load and they’ll click away faster than you can say, “But wait!”

Here’s an incredibly easy trick you can do to reducing that “but wait”-time for your blog to load. In most cases, it’s as easy as copy & paste.

Now who doesn’t like the copy, paste, and done tutorials?

Let’s first show you what to do and then for those who are interested, we’ll talk about what we did (in easy terms).

Copy This and Put It Here


<?php if (substr_count($_SERVER[‘HTTP_ACCEPT_ENCODING’], ‘gzip‘)) ob_start(“ob_gzhandler”); else ob_start(); ?>

Paste A (for WordPress users)

For WordPress users, paste the code up at the very top of your header.php file (above the DOCTYPE line). If you’re not sure how to do this, see the video at the end of this tutorial.


Paste B (for static .html pages)

If your website is coded in html and not php, then what you’ll need to do is copy the code above and paste it up at the very top of each web page you want to compress (above the DOCTYPE).

The one change you’ll need to do here is change the extension of your web pages from .html to .php.

So for example, change: index.html to index.php

What Did We Do?

Without going into a bunch of techno talk, we basically instructed, through PHP, that the Web server compress files for transit to your visitors’ Web browser by use of gzip.

I’m sure you’ve seen zip files before (myfile.zip). Zip is a compression utility that takes a bunch of data and files and compresses them into one smaller size file.

By using gzip, we compressed your blog’s data into a smaller file size before sending it over to your visitor’s Web browser. As a result, your blog loads faster for your visitor.

Simple. Easy. Works.

How To Test It

Of course you’ll want proof that your site is loading quicker. You should notice a difference in load time just by clicking around your blog before and after the line is pasted in. But if you want to see actual data, head over to http://www.port80software.com and type your blog’s address in the Compression Check box.

Here’s the results for my blog. I circled the parts that showed my after compression data.


As you can see, my blog loads more than 4 times faster with the gzip compression enabled.

Also, the file size transmitted over the Internet and to my visitor’s browser was reduced from 60,241 bytes to just 12,963 bytes. That’s a 47,278 difference in file size!

Share It

This little tip has helped many people decrease how long it takes their sites to load. If you have a moment, please consider sharing it through your social networks like Stumble Upon, Twitter, etc. While you’re at it, feel free to follow me on Twitter.

{ 59 comments… read them below or add one }

Leave a Comment

{ 1 trackback }

Previous post:

Next post: