Gzip Compression
WordPress is memory intensive and is a memory hog. The fact that it occupies lots of CPU resources and memory is nothing new. One of the best ways to optimize your WordPress website is by using compression.
What is Compression?
Compression can also be applied to websites just like files, folders are compressed in formats like .zip , .rar etc. In websites, HTTP compression, otherwise known as content encoding, is a publicly defined way to compress textual content transferred from web servers to browsers. HTTP compression uses public domain compression algorithms, like gzip and compress, to compress XHTML, JavaScript, CSS, and other text files at the server.
Most of my traffic comes from modern browsers, and quite frankly, most of my users are fairly tech-savvy. Google and Yahoo use gZip compression on their websites.
How to use GZip Compression in WordPress
Compression reduces response times by reducing the size of the HTTP response. Gzip is the most popular and effective compression method currently available and generally reduces the response size by about 70%. Approximately 90% of today’s Internet traffic travels through browsers that claim to support gzip.
If you want to take advantage of GZIP compression ( and we do recommend this ), then you WILL need an .htaccess file to accomplish that part. GZIP compression is something that should really be enabled at the Apache level or inside your php.ini file. GZIP compression can be used for things like JavaScript and CSS files as well, so why bother turning it on for only WordPress generated pages when you can enable GZIP at the server level and cover all the bases.
If your installation of Apache does not have mod_deflate installed. You can also enable GZIP compression using PHP configuration alone. In your php.ini file, you can simply add the following line anywhere: zlib.output_compression = on
Easiest Way to Enable GZip in WordPress
If you want to enable GZIP, in your WordPress installation directory put the following few lines in the .htaccess file and that is all there is to it. GZIP is now enabled!
Download the Code here .
How to Check is GZip is working for your Website?
You can check if GZip is enabled on your WordPress using the a Free online tool at GZip Test. You can perform a GZip Compression Test using the Free online tool and see the results.
By using GZip Compression, we have been able to achieve around 76% compression.
We noticed considerable improvement in our Page load times after enabling the GZip compression. How about you?








{ 20 comments… read them below or add one }
awesome article, now going to apply in my blog.
great tips thank you
You finally managed to get gzip working. Am still struggling, hope this helps
I have read the same article on another blog, quickonlinetips.com. I am sure that you have copied text from there even without crediting to @pchere.
One question: do you think that the world is dumb? And, you are the most intelligent blogger.
Kid – grow up
Hi!
If you feel this article is copied. Please provide the LINK of the website. If you think you can make false comments without properly looking into things objectively then you are mistaken. This article was written by me on 16 March 2010. If you can link the “said original article” from Quick Online Tips and prove that I have copied texts or lines. Then I would Delete this article.
Please Prove that this post is copied. Cached Google records, image Hotlinking, whatever. Now that you have commented. I want you to tell me and the readers from where has this article been copied from “Quick Online Tips”
The Email you have provided is Invalid.
If you are sure of your claims, why have you posted anonymously?
I would like to hear from you.
Ok dude. i am soooo sorry. here is the link to @qot http://www.quickonlinetips.com/archives/2010/05/leverage-browser-caching-increase-website-speed/
i just noticed that the codes are different. it is my mistake. sorry again.
You have written about gzip, and @qot wrote about browser caching. got it.
actually most of the kiddy bloggers (specially from India, Pakistan etc.) are spammers. they usually copy content/post ideas from others – and re-package. Well, you are not the one! Greets!
I’m a media worker (conventional media) based in New Delhi – and am observing trends among Indian bloggers. I’ve concluded so far that most of them (even those having good so-called reputation, and great stats – Alexa Adsense etc.) are spammers and thief.
Sorry again – and best of luck for future.
I would like to add that most people like to come to conclusion too soon. The above incident goes to prove it.
Those who copy posts and ideas do not get too far with their blogs and fall out within 6 months.
Anyways, I am glad to know that you have compared the posts and agree that all works on this blog are original.
Thanks for stopping by.
@Packson In Delhi I am amazed that being a media person you made allegations without even studying the facts carefully. Though, i am happy things are clear now. It saddening how content is copied without giving proper credit and i felt bad as an Indian blogger.
Thanks for the nice article. I am glad all confusion is sorted out. We will use it to speed up our site. All the best.
Thanks to you, I managed to come out of a weird problem. Even though I had enabled gzip compression on w3 total cache and also on my CDN, some of the gzip test tools like gidnetwork and YSlow were saying the content is not gzipped. Enabling mod_deflate and using the code you have given, I managed to gzip the content completely. I might not see huge improvements in terms of practical page load time, but I am hoping Google webmaster tool’s page speed performance shows an improvement now, will update here soon.
Thanks for taking out time and trying out our tip on Gzip compression. Actually, I had screwed my theme many times before whenever I tried to do a gzip.
This method is relatively very simple. I also waiting for google webmaters to show the expected results.
The actual page load time drop would be clear in a dew days when google shows it in site performance.
All the best
Holy Cow…. It was such an easy task… Improved blog load time by almost 5 seconds… Sweet…
Thanks for the tip. But i tried it on my webpage. I entered the code in my .htaccess file but, when i checked with gzip test tool, it shows the page is not compressed
any help ?
Thanks for this Vaibhav. I have been using Super cache and I see it has an option to enable gZip compression but I never played with it. I checked using this tool and realize my site is not compressed. Going to enable gZip compression now.
hey thanks for the post. after i installed firebug n then yslow, i was asked to compress using gzip.. stumbled upon yr post and implemented it in my .htaccess
then i headed over to the link that u provided, but it says that the webpage hasn’t been compressed. any idea?
there’s another way:
Actually you don’t need a plugin to enable GZip Compression for WordPress. Simply do the following:
1. Login to your WordPress install as admin
2. navigate to http://www.yoursite.com/wp-admin/options.php
3. Scroll down to “gzipcompression” and change it’s field value to 1, which tells WordPress “true” for GZip Compression.
4. Click Save.
/wp-admin/options.php is “semi-hidden” options screen that will give you a break down of all definable options in your WordPress install. Some fields are editable and some or not for good reason.
Hope this helps!
Great idea…….This Gzip thing is really speeding up for me. Please share more useful tips like this to speed up Wordpress,
Thanks.
Thanks for the tutorial.You can also add by placing this code ob_start(“ob_gzhandler”); within loop in index.php .Only thing is you must add this when ever you update your wordpress version
I ran my two sites with the Gzip Compression tester site. I get a message “Unknown error.” How can I find out what error is?
{ 2 trackbacks }