filosofo
WordPress Plugin: GZIP Pages
WordPress 2.5 is being released in less than three weeks. While it has a lot of exciting new features, it is also missing a feature that’s been part of WordPress for a while: the option to compress page content for browsers that support compression. Up to version 2.3.3 of WordPress, you could select this option in the admin menu under Options > Reading:
I’ve found that letting WordPress gzip pages significantly improves performance, typically slashing the size of the text to a fourth. For my home page, that’s a 30% reduction of total page size—including images, ads, etc. A 30% reduction in bandwidth is nothing to sniff at.
So I’ve written a little plugin to restore the gzip compression for WordPress blogs. It’s not necessary if you’re using WordPress 2.3.3 or earlier, but you can go ahead and install it for previous versions in anticipation of upgrading, as it won’t cause any conflicts.
Download
Filosofo GZIP Plugin 1.1 | May 3, 2008
- filosofo-gzip-compression.zip
- filosofo-gzip-compression.tar.gz
If you have problems, questions, or suggestions, please leave a comment below or open a ticket in my support forum.
See some of the other WordPress plugins I’ve created.
Like this plugin? Is it worth a latte?
This month I have received $31.50 in donations for the free plugins I offer here, which is about $0.01 per download.
38 Comments
I still haven’t tried it but it’s certainly a good idea, though.
You may want to take a look at the two extra tweaks I put into my bb-Gzip plugin for bbPress to add the support for chunked output and setting the gzip compression level to 1 (to use as few cpu cycles as possible) to enhance your plugin. It’s very straightforward.
bbpress.org/plugins/topic/bb-gzip-webpage-compression
I looked into this a bit further, and it looks like both Apache 1.3 and 2.x have support for gzip out the box, although different methods are used for utilising it with each.
Seeing as the official WordPress reason for removing the gzip option was so it’s handled by Apache, which is theoretically faster than PHP having to do it, it’s probably preferable to do this. I also noticed that the total file size of WordPress’s pages is smaller when Apache gzip is used rather than the internal WordPress (PHP) gzip method.
A little Googling will find you Apache 1.3 instructions I’m sure. But for those using Apache 2.x like me, sticking this in a .htaccess in your site’s root should do the trick:
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/json application/x-httpd-php application/x-httpd-fastphp application/rss+xml application/atom_xml application/x-httpd-eruby
Header append Vary Accept-Encoding
If it doesn’t work, your host needs to install the deflate module (usually enabled by default). Ask them and they should be able to do it.
That will not only gzip your WordPress pages, but also the CSS, XML, and JavaScript files — none of which are gzipped when the old WordPress function is used.
You can add any MIME type to the collection above, but do bear in mind that you *don’t* want to be gzipping stuff like images, Flash files, etc, as they’re inherently already compressed; indeed, gzipping these will slow you down. I suggest just sticking to those above.
I decided to take WP 2.5 and the GZIP pages plugin for a whirl. The strangest thing happened– as I started to post a comment, my code tab disappeared and the features on the visual tabs are inactive. Needless to say, I ditched both 2.5 and the plugin and returned to the previous version.
this plugin works nice, but if anyone want also style.css compress can use this tips
lonewolf-online.net/computers/knowledgebase/php_reduce-wordpress-bandwidth-usage/
I’d really love to use this plugin as it speeds up delivery of my blog pages by over three times!… however, it also breaks tinyMCE.
Before 2.5 I never used the visual editor, but it’s much better in the new version of wordpress, so I’d really like to have gzipping enabled, but also have use of tinyMCE.
Could you look into this please? — Perhaps there’s a way for you to gzip delivery of the blog, but not wp-admin?
Cheers, and thanks for contributing plugins to the wordpress community.
Thanks for pointing that out Milorad. I’ve updated the plugin in version 1.1 to work with TinyMCE. This should solve scoop’s problem as well.
Many thanks! that has to be the fastest response to a problem report I’ve ever seen or heard of.
Nice work
Is this compatible with wp-cache? What do I need to do to make it work together?
I don’t know about WP-Cache, but WP-Super Cache has Gzip functionality built in, so you don’t need to use this plugin if you use it.
Im using WP 2.6 and activated your plugin. How to validate it works or where to active the function?
If you’re using Firefox, you can right-click your blog’s page, select “View Page Info,” and then under “header” see if there is a “Accept-Encoding: gzip,deflate” line.
I installed and activated this plugin, but there’s no additional headers added. “View Page Info” doesn’t show anything. I added the following to my header.php manually:
<meta http-equiv=”Content-Encoding” content=”gzip” />
<meta http-equiv=”Accept-Encoding” content=”gzip, deflate” />
What does the plugin do that’s different? Did I do something wrong with the plugin?
“View Page Info” doesn’t seem to show the response headers anymore when using Firefox 3, but I know they’re there from other tools, so I think it’s “View Page Info” that has changed.
Adding the http-equiv meta tags probably doesn’t do anything.
Any idea for what tool I can use to view the updated headers?
Try the Firefox “Web Developer” extension.
Does it work with WordPress 2.7 … it seems to work with FireFox but not with IE7 on Vista
I have the same issue as Kingsley Tagbo; it doesn’t work with IE on Vista.
I have to tell you man, that SUCKED to find out. I, stupidly, didn’t test that it worked in IE because it worked in FF3.
I just needed a quick fix so I added the below to the plugin around line 24:
if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE 7.0; Windows NT 6.0') !== FALSE){
return FALSE;
}
All it does is not compress for IE7 if it’s coming from a Vista machine. Not a long term solution but since most of my visitors use FF or Chrome it’s ok with me not to gzip for IE7.
Well, I did some research on the issue and it looks like IE7 just doesn’t like gzip AT ALL. Weirdest. Thing. Ever.
Do a google for “gzip IE7″ (without quotes). There are all sorts of stories about how IE7 doesn’t work with gzip. Pity…
It looks like the fix provided above is the long term solution. That really, REALLY, sucks.
Does it work for IE8?
Does it help much to improve website load time ?
Thank you so much for creating this plug in! I’ve been searching around for the best way to implement G-Zipping on my blog as it’s fairly image and DNS request heavy but I wasn’t having much luck.
You’ve saved the day, and my bounce rate!
That is great plugin,Thank you very much.
Do this plugin works with wp 2.8 ?
Thank you.
Its cool but we have WPsuperCache for this purpose. Isn’t it?
You’re correct: WP-Super-Cache includes this feature, so if you’re using it you don’t need this plugin.
Thank you. I am going to try it
brilliant!
now with google page speed, this is a must
it’s maybe not possible due to file-permissions, but could this plugin also compress .js + .css files used by various plugins
I think this is what I’ve been looking for…. I’m looking to improve the page speed of my wp blog – googles webmaster tools suggested I “gzip and cash static items”
Please let me know that I’m on the right track and please point me to a step by step tutorial to install and run this program. Assume I know nothing, because I have no idea what I’m doing
Thank you!!!
How can I test to see if the plugin has worked?
You can test the functionality of mod_gzip at www.whatsmyip.org/http_compression/
plugin filosofo december content apache
for its contents. This is a safe-cache copy of the original web site.