How to Set Up the W3-Total-Cache Plugin

Tools for setting up. My Google Analytics keywords report is telling me that one of the more searched for items on this site is ‘how to set up W3-Total-Cache’ – so here goes.

Before starting, though, a word of caution: server configurations vary between hosting providers, so your first step should be to ask your hosting provider for their recommended settings.

Of course, some may not be familiar with the plugin, so won’t be able to help.

But there are many who are familiar with it, and following their guidelines will ensure your settings are optimized for the server your site is on.

My hosting provider, Hostgator, not only recommended W3TC, they gave me their recommended settings for it – that’s service!

With that in mind, I’ve described how I set up my version. But do remember that your server configuration may be different, so these may not be optimum for your site.

The current version of W3TC at the time of writing is Recent upgrades of the plugin have brought some major changes, so you should review the settings and options each time there’s an upgrade.

And remember that if you change the theme you’re using you’ll need to add the new stylesheet URLs to the minify section.

W3-Total-Cache General Settings

So here are the settings I’ve used for W3TC:

General settings

Preview mode is enabled. This enables me to view any changes I’ve made before deploying them, to ensure they haven’t screwed up the site.

Page cache via disk (enhanced) is enabled

Minify is enabled, minify mode is manual, minify method is disk, HTML, JS and CSS minifiers are all default.

Database cache is enabled, method is disk.

Object cache is not enabled (recommendation from Hostgator, based on the server configuration).

CloudFlare is not enabled. The reason for this is that CloudFlare was originally a security and anti spam application and is part of the Honey Pot project.

This site is already part of the Honey Pot project through the Bad Behaviour plugin, so I don’t need CloudFlare.

However, if your site is not part of the Honey Pot project then it’s well worth looking at CloudFlare, especially as it gives you performance benefits as well.

Varnish. This is a server application so you need to know whether the server your site is on has Varnish installed.

Don’t enable this unless it’s installed on your server – you’ll need advice from your hosting provider.

Content Delivery Network. If you have a CDN you can enable this for your CDN type.

Browser Cache is enabled

Support us – entirely up to you!

Debug. I use this only when I get an error message while making changes to settings. I’ve only had to use it once and it cleared the error immediately.

Miscellaneous. All options are checked except for Enable File Locking. Note that you’ll need an API key for the Google Page Speed widget.

Import/Export Settings. It’s definitely worth exporting your settings file so you have a backup on your local machine. Click ‘Export configuration’ and save the file locally.

Individual page settings

Page cache settings

General. All options are checked except for ‘Cache URI’s with query string variables’.

Advanced. I’ve left all sections in this category at the default settings. The item most people will want to review is the ‘Never cache the following pages’.

If you’re running a contact form with CAPTCHA you’ll want to add the page it’s on to this section, otherwise your CAPTCHA code won’t change each time the page is loaded.

Cache Preload. All settings are default.

Purge policy. All settings are default.

Minify cache settings

General. ‘Rewrite URL structure’ and ‘Disable minify for logged in users’ are both checked.

Disabling minify for logged in users ensures you’re able to immediately see any changes when you’re making adjustments to design or layout.

Minify error notification is disabled

HTML and XML. HTML minify settings are all checked except ‘Don’t minify feeds’.

Ignored comment stems are left at default.

Java Script. ‘Enable’ and ‘combine only before /body’ are checked. The rest are unchecked.

Adding Java Script files to be minified is best done by clicking the ‘Help’ button above the General section, near the top of the page. This will pop up a window displaying the JS and CSS files on your site that can be minified.

Because some JS files don’t minify well, or minification may stop them from working, it’s best to check one file at a time.

Click the check box next to the file, click ‘Apply and Close’, then click ‘Save all settings’ and preview your site.

If everything is working properly, add another JS file and check your site again.

The other way to add JS files is to view the source of your page and copy the full URL of the file you want to minify. Then click ‘Add a script’ and paste the URL into the box that appears.

Cascading Style Sheets. All items are checked except ‘Combine only’.

Leave @import handling at the default and add CSS files using the same process I described earlier for adding JS files. The CSS files that can be added are displaid below the JS files in the window that pops up when you click the ‘help’ button.

I select ‘All templates’ in the ‘Template’ box, but you may need to select specific templates if you want some to be excluded.

Advanced. I leave all sections in this category at the default settings. If you’re making frequent updates to your site layout or design you may want to reduce the time interval in the first box.

Database cache settings

General. ‘Don’t cache queries for logged in users’ is checked. This ensures you can immediately view any changes you make to design and layout when you’re logged in.

Advanced. All settings are left at default.

Object cache settings

This is disabled on my site so I can’t suggest settings here, I’m afraid.

Browser cache settings

General. All options are checked except ‘Prevent caching of objects after settings change’.

Cascading Style Sheets and Java Script. All options are checked except ‘Prevent caching of objects after settings change’. The expires header lifetime and cache control policy settings are both left at default.

HTML. All options are checked, with expires header lifetime and cache control policy settings left at default

Media and other files. All options are checked except ‘Prevent caching of objects after settings change’. The expires header lifetime and cache control policy settings are both left at default.

User Agent Groups settings

This is enabled by default and mostly defines how to deal with visitors using a mobile device.

Everything is at the default setting here and the only section you need to be concerned with is ‘Redirect users to:’, and then only if a 3rd party site (such as Mippin, for example) is providing the mobile version of your site.

If that is the case you’ll need to add your mobile URL here.

Referrer groups settings

This section is also enabled by default and refers to the search engines or other sites that send large amounts of traffic to your site.

Again, all settings are at the default.

You would create a group and assign a redirect URL only if you wanted traffic from a specific referrer (or group of referrers) to see a different theme.

CDN settings

I don’t have a CDN, so this section is disabled for me. If you do have a CDN you will need to enable it and enter the FTP and other details of your CDN.

After saving your settings

If you enabled ‘Preview’ on the general settings page be sure to check that your site is looking as it should do, and then remember to click ‘Deploy’ to make the settings active on your live site.

I reviewed the first version of W3-Total-Cache that I used here, but it’s changed quite a lot since then.

The thing you’ll notice most on a day to day basis today is that changes you make to your site appear not to show up once you’ve logged out of your admin area.

This is simply because you’re seeing the earlier (cached) version.

So if you want to be sure that you and your visitors see the new version immediately be sure to empty the page and minify caches after making changes to your site.

The plugin will also ask you to empty your page cache whenever you reactivate a plugin.

This mostly happens after plugin upgrades, but if you’re reactivating multiple plugins (for example after a WordPress upgrade) it’s good to leave reactivating W3TC to last.

That’s it – any questions leave a comment.


Martin Malden

What do you think?

Comments on this entry are closed.

  • Tony Nov 20, 2011 @ 14:49

    Thanks for the step by step. I hope you can remake this with some pictures, specially for the ‘Help” button that shows the Javascript files and Css files below. I had a hard time finding that. Thanks again.

    • Martin Nov 21, 2011 @ 7:55

      Hi Tony,

      Thanks for the suggestion – I’ll create some screenshots and update the article.



  • Mark Nett Dec 26, 2011 @ 22:40

    Martin Thanks for stepping & giving a clear idea in setting up w3total cache.Now my blog loads faster than before

    • Martin Dec 27, 2011 @ 8:02

      Hi Mark,

      You’re welcome – glad it’s working well for you!



  • Joel Apr 10, 2012 @ 2:19

    Thanks for the step-by-step instructions. I’m a volunteer with a dog/cat rescue group and assist with maintaining their website. The webmaster hasn’t been a resource, so I’ve been looking for setup information for several weeks. You made my day and the rescue will be very happy to see the improvements.

    • Martin Apr 10, 2012 @ 6:48

      Hi Joel,

      You’re very welcome, and I’m delighted this was helpful 🙂



  • kalyan Jun 21, 2012 @ 1:58

    Thanks for the wonderful post Martin. Now, I am confused.. You said Hostgator recommends this.. now, I am chatting with a Hostagor rep and he recommends WP super cache over W3Total.. Just lost in it now?? Any idea.. ??

    Last time my blog crashed and I had a horrible time in recovering it and the culprit was W3 Total. ..Worse.. it was very difficult to delete the files too… anyway I managed and now blog is without any caching plugin.. at a loss now as to which one to choose from….any suggestion or shall I again go for W3 total??

    • Martin Jun 21, 2012 @ 7:41

      Kalyan, hi,

      At least you’re using Hostgator – that’s a good start..!

      I don’t know why they would now recommend SuperCache – maybe some subsequent updates have improved its performance. I’m still running W2TC on about 50% of the sites I manage and it’s working fine, with the settings I’ve described above.

      There may, of course, be a clash with your theme or another plugin, that may be causing you problems. Unfortunately you have to look at the entire picture, not just one element of it.

      Another thing to consider: the sites on which I’m not running W3TC perform very well – pretty much indistinguishable from the sites on which I am running it.

      The difference between them is that the sites where I’m not running it are fairly straightforward: not too many images (and all optimised), not too many plugins (9 on most of them, and 3 of those are site admin plugins (backup, optimisation and delete revision) and Gzip enabled. (There’s a link in that article to an excellent article about speeding up your website on SEOMoz).

      It may pay you to look at the overall config of your site to see whether you really need a caching plugin.