Who doesn’t want lightning fast page delivery? Is your WPMU site operating at a painfully, embarrassingly slow speed? People are impatient when it comes to site load times and will often leave if it takes longer than two seconds to see the page. The information available to internet users is increasing exponentially and people have no time to waste on slow loading websites. Optimizing your WordPress blog for speed is a serious matter of competition for the attention of your user. The faster you can serve your pages, the better chance you have of lowering your bounce rate. This small piece of code will take you less than a minute to paste into your site and can instantly have your site running approximately 3-4 times faster than before. It’s called zlib compression.
What is zlib Compression?
zlib is a lossless data-compression library that will help you to serve your pages faster. Basically it compresses the PHP that WordPress sends to your visitor’s browser so that it displays much more quickly. Compressing and sending is much faster than sending the PHP in its full size format. Believe me, you will love it.
How do I use it?
First, do a quick check to make sure that zlib is enabled on your server. Paste this into a text file, save as it test.php, and upload to your server:
<?php phpinfo(); ?>
Visit your test page and it should display everything you ever wanted to know about PHP running on your server. Scroll down until you find the zlib header and check to see if it’s enabled. If it is, then you can proceed to the next step. If zlib isn’t enabled, Twitter Tools & Apps, contact your host. I can’t guarantee that they will enable it for you, but the change in speed is so significant that it’s worth a try.
Add this small bit of code to the header.php file of your theme. Place it directly above your doctype at the beginning of the file.
1 2 3 4
<?php ini_set(’zlib.output_compression’, ‘On’); ini_set(’zlib.output_compression_level’, ‘1′); ?>
Update the file and the change should be instant. You will probably notice it even before you use tools to test the output. I recently tested zlib with one of my WPMU sites and it helped me to serve my pages 3.5 times faster than before compressing- an unbelievable improvement! You can check your compression factor at: http://www.port80software.com/support/p80tools.asp. It will tell you if compression is working on your site and the percentage and number of bytes saved, as seen below one of my sites.
I first learned about it from Brad Ney in his helpful post. It’s important for you to know that this technique is compatible with WP Super Cache, which is a plugin that I highly recommend for anyone running WPMU. It causes your blogs to serve static html pages to the majority of your visitors, specifically those who are not logged in, have never left a comment or have never viewed a password-protected post. This plugin can really save the day if you or any of the bloggers on your WPMU network have a post that gets a lot of attention and you experience a sudden spike in traffic. If your server can’t handle that amount of traffic, you can cause a crash during what ought to be your shining moment. Get your site prepared before this happens. If you’re using shared hosting that is completely oversold and overloaded, this plugin will also give you an instant boost.
These speed-enhancing methods are not just WPMU-compatible but will dramatically increase the speed of a single-user WordPress blog as well. You may not be able to afford higher quality hosting, but now you may not have to. These tools should improve your site’s load time with any host. They are also compatible with all major browsers, even the ancient ones. Combine zlib compression with WP Super Cache and you are on the road to a super fast loading site!