I was upset when iGoogle went away recently, so I decided to make my own start page. I wanted it to be able to display rss feeds from several sites. I decided on the great SimplePie php library to aggregate the feeds. Then I hit a speed bump...literally. The page looked great, but it took FOREVER to load. We're talking several seconds...every time.  After some research, I made sure I had the proper header tags to enable caching, which helped some. But what I really needed was gzip.

Here's the rub...I know how to enable on-the-fly gzip compression in the .htaccess file:

# ENABLE GZIP COMPRESSION
 <ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
 </ifmodule>

 

But my web host isn't configured correctly, so it has no effect.  Then I came across this little gem:

<? ob_start("ob_gzhandler"); ?>

Just place that at the top of each page, and you're all set! My page load time went from an average of over 4 seconds to milliseconds.

Add a comment