One of the problems with WordPress is it’s dynamic page structure requiring a lot of server side CPU power to build each page. This is fine most of the time but if you ever hit the front page of Digg, Stephen Fry Re-tweet you or anything resulting in a traffic spike your site will slow down or maybe even crash as your server can’t handle to load. One way of lightening the load for your server is caching pages as HTML, for this I use and recommend W3 Total Cache.

W3 Total Cache also has a number of other feature that I will go though but the big one I (and my sites) can’t live with out is the page caching. Another big help is the ability to leverage browser caching and minifying of HTML, CSS and JavaScript. W3 Total Cache has very granular controls allowing you to customise the experience to your sites specific needs.

The settings I use are as follows:


On the general tab I enabled page caching and minify and setting them to disk (enhanced) and disk respectively I also disabled database and object caching. I enabled CDN and choose Rackspace Cloud Files as my CDN type; I also enabled browser caching.

Page Cache

Under page cache I don’t cache for logged in user nether for 404 pages but I do cache the home page and feeds. I added a list of mobile user-agents the the rejected agents list so they can receive an optimised version and not have the mobile site cached and displayed to desktop user. The rest of the settings I left as the defaults.


For the minify settings I rewrite the URL structure and automatically upload modified files to the CDN and send error notification to both the admin area and email. I minify HTML, inline CSS, inline JS and remove line breaks but not feeds. I also minify JavaScript, combine scripts in the after <head> and <body> and before </body> as well as removing comments and line breaks. For CSS I combine and remove line breaks and comments. I have also added external Javascript and CSS files that need to be minified.

As I didn’t enable object and database caching on the general settings page I left these settings alone.

Browser Cache

On browser cache I set expires, cache control, eTag and W3 Total Cache headers, enable gzip compression under general. Cascading style sheets & JavaScript I set expire (lifetime of 3600 seconds), cache control (cache with validation for policy), eTag and W3 Total Cache headers and again enable gzip. For the HTML I only enable gzip compression.

For media and other files I set expire (lifetime of 31536000 seconds) cache control (with a policy of cache with validation), eTag and W3 Total Cache headers and again enabled gzip compression.

I left the user agent settings alone

Content Delivery Network

For the CDN settings I host the wp-includes/, theme, minified CSS and JavaScript and custom files on the CDN. I do not force over-writing of existing files and I do import external media. I configured my Cloud Files API key and container without setting up any additional CNAMES. I also enabled changed files auto upload and left everything else as default.

While these settings are optimised for Rackspace Cloud Sites most of them will be fine on almost any hosting environment.

I choose Rackspace Cloud Files for my CDN not to keep everything on one bill but because after testing I found them more consistent then Amazon CloudFront and a little cheaper for large amounts of data especially for older content that is not cached in the CDN edge locations.