Speed Up Your Website with GZIP Compression


I love little tricks that make a huge difference to a website. This addition can cut your bandwidth, possibly by as much as half, and it will make your pages load faster for those on slower connections and all you have to do is enable GZIP compression.

There is a great post over at BetterExplained that goes into more depth about how to implement GZIP compression if you are using Apache 2 and it is worth reading.

A lot of hosts don’t run Apache 2 on production servers though, and I know that my servers are not running Apache 2. You can get the same benefits by adding some very simple PHP code to your web pages.

Now if you build your website with templates and PHP includes for headers and footers, you will only have to add this PHP code to one file to start delivering your web pages with GZIP compression. I have started using this on both this blog and Video Rambler and the compressed pages are often half the size of the uncompressed page. Here is a screenshot of the index page document size. Notice in the screenshot of the document size that the majority of the document size is images, mostly from MyBlogLog. Gives me reason to rethink whether or not I should keep it on the site.

Categories: web-programming 
Comments