Codex tools: Log in
WordPress on its own does not offer a mechnism to compress the blog's HTML output. This normally is a feature provided by the webserver (Apache, see Enabling Compression) or based on the configuration the PHP scripting language offers (see zlib configuration).
If you prefer to enable or fine tune output compression with the apache server, you might find this code-snippet for an .htaccess file usefull:
In case editing the servers configuration is not an option for your site you might want to enable compression within the PHP-code. A single small line of code within the index.php file will do the job. Just add
ob_start('ob_gzhandler'); on top of your index.php located in the root directory of your WordPress installation:
<?php ob_start('ob_gzhandler'); /** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */ [...]
NOTE: For better results, you should edit your main index.php file, not the index.php of your theme(s). Therefore, keep in mind that this file will be overwritten next time you update wordPress, so you need to modify it again after an update.
You need to have the Zlib Compression Functions in PHP in order to get this work.