Setting up and Configuring W3 Total Cache Guide for WordPress

W3 total cache is by far the best plugin for caching and optimizing the front end of WordPress. I say front end because there is a lot more that can be done on the back end. If you would like to know more about that you can send me an email via the contact page. Back end optimization is for VPS and Dedicated servers as shared hosting is very limited to what can be done.

You might be thinking why I decided to write this guide, the simple answer is even though there are other great guides out there the simple fact is not enough people configure this plugin correctly and so they have it installed but it’s not doing anything other than using resources. So I am going to go through all the configuration you need to get this plugin working to it’s maximum potential for your site.

Ok let’s do this.


No point reading any further if you don’t have the plugin installed.

  1. Head over to plugins in your wordpress admin panel.
  2. Select add new
  3. Type W3 total cache
  4. Select install now
  5. activate

Some issues you may face:

You may encounter an error or warning about permissions for wp-content needing to be 777 or 755, to change permissions head to your cpanel or whatever interface your using for your server and open the file manager.

Right click on wp-content and select change file permissions and change accordingly.

If you are required to change to 777, change it back to 755 after install.

Now you have the plugin installed and activated you can move on to configuring the plugin.

Initial Setup

Look to the right of your admin panel, you should see a menu called Performance.

Select this and you will be take to a screen just like this.

Click to view a larger images

First thing you need to do is select disable where is says Preview mode is active:

You won’t believe how many times I have seen this enabled, so even if you configure the plugin it will still do nothing while in preview mode so disable it.

Next while still in general settings ensure that the following boxes are checked.

  • Page Cache (Note this is not necessary for all)
  • Browser Cache

We will look at Minify and CDN further down.

Page Cache

So once the general settings are configure head over to page cache by selecting the link either in the sidebar to the left or at the top of  W3’s general settings page.

Inside page cache settings ensure the following options are enabled.


  • Cache post page
  • Don’t Cache front page ( use this if you have dynamic content on your home page – such as latest posts, sliders etc)
  • Cache feeds: site, categories, tags, comments
  • Cache requests only for site address
  • Don’t cache pages for logged in users


  • Garbage collection interval:

This setting depends on how busy your site is. The default is 3600, but you could lower this if you have a busy site because it will use up disk space and if left unchecked you will soon run out, just like your browser if you don’t clear cache with tools such as C-cleaner you will find your hard drive filling up everyday. So the job of garbage cleaner is to remove old cache.

There are no more settings that need to be looked at in advanced.

Cache Preload

Also known as priming is used to preload the most important pages on your site.

  • Tick the box to enable it
  • Update interval: 900
  • pages per interval: 10
  • Add you sitemap which should be

Purge Policy

There should be no need to change the default settings here.

Object & Database Caching

Both these settings are not required and in many cases can cause issues that outweigh any potential gains.

Browser Cache

This is the one that most people forget to configure. In it’s default state it looks like this.

This is where the biggest gains for your site will occur and yet the default settings exclude these vital optimization techniques so you should enabled the following.

Set expires header

This option is there to encourage the browser to cache resources locally. I.e. on your computer. This helps to reduce the load to the server for returning visitors which is always a good thing, because we want maximum performance with the ability to serve as many people as possible without making the server unstable.

The Expires Header is enabled for all resource types and you can specify the timeout for each of the following:

  • CCS & JS – Set the Expires header lifetime: (31536000) seconds, which is 1 year.
  • HTML & XML – Set the Expires header lifetime: (3600) seconds, which is 1 hour.
  • Media & Other files – Set the Expires header lifetime: (31536000) seconds, which is 1 year.

The options to specify are located further down the options page as you scroll down. For each you can specify the following options:

Set cache control header

Cache control Headers are basically the policy of your cache, the header information assigned to each file determines how long the file is considered fresh, to do that we need to apply a cache control header so the browser knows how long to store the representation of the file, before requesting an updated version.

Typically I would use:

cache with max-age ("max-age=EXPIRES_SECONDS, public, must-revalidate, proxy-revalidate")

To break this down a little, it is saying.

  • Cache the file using max age – I.e. the time in seconds that you set in the Expires header.
  • Public – This marks authenticated responses as cacheable.
  • must-revalidate – this ensures that the cache will be updated when the Expires headers max age expires. HTTP cache allows browsers to cache stale representations, so here we are simply saying, obey the max-age.
  • proxy-revalidate – similar to must-revalidate, except it only applies to proxy cache. A CDN that serves cache, would be an example of proxy cache, because it is not on your main server.

Set W3 cache header

As it says this is just assisting in identifying optimized files.

Enable HTTP (gzip) compression (this will only work if your server permits it)

Gzip compression can boast some of the largest gains in terms of performance, but it does require more power and resource ussage from the server.

It is for this reason, that most shared hosts do not allow it. Shared hosts are already at there limits, enabling gzip compression would most certainly crash a shared host. But if your on a VPS or Dedicated server you will see big gains from this.

Your completed configuration should be as follows:

w3 total cache browser settings

Do not enable the following:

Set entity tag (eTag)

You should turn these off by adding the following to your .htaccess file found in the root folder of your site via the file manager. Remember to select show hidden files otherwise you won’t see it in cpanels file manager.

Header unset ETag
FileETag None

Adding this to your .htaccess will also remove other server generated queries, some users may see something like ?132490 appended to all resources, that would be an E-tag, so if you still have lots of queries after configuring W3 then make sure you disable and unset all Etags or you may still see a query appended to static resources.

If you want to remove all other query strings that are not encoded directly to the resource then you can use this function found here.

Prevent caching of objects after settings change

Again do not enable this, it will turn your resources in to queries and this is bad for caching, bad for CDN’s and bad for performance.

Content Delivery Network

There are plenty of content delivery networks out there, but the ones that I have had the most experience with are amazons S3/Cloudfront and Max CDN which is what I use.

There are pros and cons to all CDN’s but what I like about Max CDN is the simplicity in setting it up as well as the pay as you go payment method.

I will be writing further posts about setting up both Amazon s3/Cloudfront and Max CDN.


This option should never be enabled as it can cause unexpected issues. A well developed site will have no need for minification if the smart use of resources are enacted.

If you do need to enable this option then you should select the manual option and then begin the process of including your style sheets and scripts one by one – yes it is more work, but it will help you identify problems as soon as they arrise.

JavaScript is sensitive to the order in which it loads when dependencies are involved. If this order is not maintained during minification then some features will break and cease to function.

Meet the Author

Matthew Horne

Matthew Horne is web developer who specializes in optimized development. He also builds custom solutions instead of reverting to plugins. Matthew Has a strong understanding of PHP, JavaScript, jQuery.

27 comments… add one
  • anshit Dec 6, 2012, 9:22 am

    great post . .

  • Nate Dalliard Dec 13, 2012, 2:07 pm

    Hi Matthew,

    “We will look at Minify and CDN further down.”

    Would be very cool when you add your thoughts and the optimal setting for minify and cdn also. The post is awesome! 🙂 Thank you!

    • Matthew Horne Dec 14, 2012, 6:07 pm

      I am still thinking about that, minify settings have proven to be problematic, I am testing a few things out to help people out, so I left it out. I will make a note of it on the post, thanks.

      • Nate Dalliard Dec 14, 2012, 6:14 pm

        Thats absolutely okay. The things you post here are mind-blowing. One, two, three things and my Blog is faster then ever! 🙂

        • Matthew Horne Dec 14, 2012, 6:20 pm

          Thanks, its kind of an addiction lol, I just can’t ignore something if its not efficient.

          Glad you dig the site. But wait till you see the new responsive site that im developing.

          A few more things to do before I can roll it out.

        • Matthew Horne Dec 14, 2012, 6:24 pm

          Hey you know there are some filters to control the number of tags and catz that display, that will cut down some queries to the database and also neaten up the footer. You want the filters?

          • Nate Dalliard Dec 14, 2012, 6:25 pm

            Please. But I am not sure that I can implement these filters. It’s for thesis 2.x?

          • Matthew Horne Dec 14, 2012, 6:26 pm

            No for wp, its part of the core.

          • Nate Dalliard Dec 15, 2012, 8:07 am

            Hmm, the thing will be, when the next wp update is coming, that I’ve to change the code again – or isn’t it so?

  • Avinash D'Souza Jan 10, 2013, 8:46 pm

    Would love to see a bit more on minification, Matthew….as an update to this post.

    • Matthew Horne Jan 11, 2013, 4:47 am

      Yes, I have a few projects that I need to complete, then I will talk about minification.

  • Charles Dow May 2, 2013, 1:34 pm

    I would appreciate an exported configuration file that I can use to force the file locations. I have a persistent caching problem where the system keeps referring to an old location though the site has been moved.

    • Matthew Horne May 2, 2013, 4:02 pm

      Best thing you can do here is first, disable w3 total cache, the using an ftp program or your servers file manager, locate this file (w3tc-config) inside wp-content and delete that, then re-install w3, it will be as though you have just installed it, from there you can configure the plugin as normal. The only file that could cause an issue like yours is the w3tc-config file which is where all your settings are stored.

      Let me know if that works for you.


  • Marco Jul 30, 2013, 8:51 am

    Oh thanks! Now My Gt Metrix’s grade is over 80 %! THANKSSS! 😀

  • Video drole Oct 11, 2013, 4:31 pm

    Ok, thanks for this post.
    Can explain how cached ads videos with w3tc ? Or if impossible, how optimise it?

    • Matthew Horne Oct 12, 2013, 4:02 pm

      Hi, unfortunately you can’t cache resources that are not on your server. 3rd party files cache is set by the server that sends it.

  • mahady Oct 26, 2013, 3:25 pm

    Thanks for Sharing Is a very good Article and Very amazing Tips

  • Abuzar Khan Nov 14, 2013, 7:07 pm

    It’s very nice post. I was unable to understand how to configure w3 total cache plugin with ssl enabled website. After reading your post i successfully configure this plugin for my website. Thank you so much for such a nice post. God Bless You.

  • Daniel Dec 1, 2013, 9:49 pm

    Very nice info, please can explain how configure w3 total cache plugin for dedicated server?

  • raj Jun 22, 2014, 4:13 pm

    In picture Enable HTTP (gzip) compression is enabled and in description you telling not to enable

    Can you tell what to do?

    • Matthew Horne Jun 25, 2014, 4:19 pm

      It should be enable, i will update the image to reflect that.

  • siddle Oct 9, 2014, 9:13 am

    The plugin is really helpful to minify css and html request

Leave a Comment