GZIP Compression and WordPress

I had an issue back in November 2014 trying to enable GZIP compression with WordPress. A spare half an hour was found last week that allow me to solve the problem. I resorted to a .htaccess file change. I simply added this to the top of the .htaccess file:

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

Now the WordPress site is being delivered to clients in GZIP format. This results in a significant speed improvement in page rendering as well as a significant decrease in the bandwidth my server needs to deliver. Furthermore, it’s superior to the ob_gzhandler method suggested by WordPress themselves because CSS and javascript files are compressed as well as the HTML. The ob_gzhandler method appears to only compress the HTML.

This entry was posted in WordPress on by .

About markn

Mark is the owner and founder of Timesheets MTS Software, an mISV that develops and markets employee timesheet and time clock software. He's also a mechanical engineer, father of four, and a lifelong lover of gadgets.