The ultimate guide to W3 Total cache settings

the ultimate guide to w3 total cache settings
 

There are many performance optimization plugins for WordPress like : WP-Super cache, Hyper Cache, DB-Cache Reloaded Fix etc. But we will discuss only W3 Total cache in detail as it has the deepest possibility of customization. So we will give you W3 Total Cache settings which are the best.

Because of the recent updates like Penguin and Panda , the loading time of websites plays a critical role in a website’s search engine rankings. There are several ways to speed up a website. Caching, database caching, object caching, minifying. The real beauty of W3 Total cache is that it makes it easy to do it all at one place.
So, let’s start the tutorial without wasting much time :D

W3 Total Cache settings :

the ultimate guide to w3 total cache settings

1.) First of all install W3 Total Cache and activate it.

2.) Now after activation deactivate the Preview mode. To deactivate it , just click “Performance” on the left side of your WordPress dashboard and click “disable” button on the Preview section.

Now we will do the rest of the process step wise.

General Settings

  • Enable Page Cache, use “Disk : Enhanced”. If it’s showing up in your options then you can also select Opcode : Alternative PHP cache as it’s the best.
  • Enable Minify, set it to “manual”. Use “Disk”. If it’s showing up then you can also select Opcode : Alternative PHP cache as it’s the best.
  • Enable Database Caching. Use : “Disk”. If your wp-config is not writable due to some security plugin then set it to writable for optimal working of Database Cache.
  • Enable Object Caching. Use : “Disk”. It’s great for sites with heavy traffic.
  • Enable Browser Cache. It helps in leveraging browser caching.
  • Enable Verify rewrite rules, and if you have a Google Page speed API, then it’s your choice to enable Dashboard Widget.

Optionally you can enable “Optimize disk enhanced page and minify disk caching for NFS“. It helps on some shared hosting setups.

Advanced settings

W3 Total Cache settings For Page Cache

  • Enable Cache front page.
  • Enable Cache feeds: site, categories, tags, comments.
  • Enable Cache SSL (https) requests.
  • Enable Cache requests only for www.yoursitename.com host name.
  • Enable Don’t cache pages for logged in users.

For Cache Preload

  • Enable Automatically prime the page cache. Set update interval as 907 seconds or something close. Select number of pages 15 (increase or decrease depending on hosting).
  • Enter your sitemap URL. And enable Prime post cache on publish.

For Advanced

  • Set Maximum lifetime of cache objects: 180060 seconds.
  • Set Garbage collection interval: 3600 seconds.

W3 Total cache settings for Browser cache

  • Enable set Last-Modified header, set expires header, set cache control header, set W3 Total Cache header and enable HTTP (gzip) compression.
  • Set all the cache control policies to : Cache with Max-age.

For CSS & JS

  • Set expires header lifetime : 31536000 seconds (over 1 year).
  • Enable set Last-Modified header, set expires header, set cache control header, set W3 Total Cache header and enable HTTP (gzip) compression.

For HTML & XML

  • Set expires header lifetime : 7200 seconds.
  • Enable set Last-Modified header, set expires header, set cache control header, set W3 Total Cache header and enable HTTP (gzip) compression.

For Media and other files

  • Set expires header lifetime : 31536000 seconds.
  • Enable set Last-Modified header, set expires header, set cache control header, set W3 Total Cache header and enable HTTP (gzip) compression.

 W3 Total Cache settings for Minify.

  • Enable rewrite URL structure and disable minify for logged in users. Set error notification to Admin notification.

For HTML & XML

  • Tick on enable, inline CSS minification, inline JS minification and line break removal.

For CSS

  • Tick enable, preserved comment removal and line break removal. Now go to your website in some other browser and right click and view source. Find the CSS files, and add their urls one by one in the CSS minification box. Do this to see whether something breaks the layout on minification or not.

For Advanced

  • Update external files every : 216000 seconds and same for garbage collection.

For JS

This is the most difficult part of setting up W3 total cache settings. It requires some trial and error. Do it if the above steps were not enough.

  • Tick on enable, preserved comment removal and line break removal. Now got to the source of your site as before and find only those js files which are hosted on your website. Now add their urls one by one and check every time whether something is breaking your site or not.
  • NOTE : Customscript.js and the themes js files like themename.js should not be minified as mostly they are the ones which cause errors.

W3 Total Cache settings for User agent groups.

Just enable it and don’t change anything.

NOTE : If any setting is not there in this guide then leave it to the default value.

Checking the cache

1.) Open any other browser and clear its cache and then open your homepage URL. Now right click and click on “View Page Source” and at the bottom, it should look like the screenshot below

w3 total cache settings check

2.) Go to tools.pingdom and check your site load time. If everything is working well. You can expect results like below.

w3 total cache settings test

If the Optimal Settings do not work for you. Follow these steps :

1.) You can try WP-Super cache. And learn to customize it here. Using it along with DB-Cache reloaded fix will give you nice results. But not better.

2.) Disable Gzip compression and see if it works well.

3.) You can comment below so that I can help you in fixing errors.

If you have any problem in the above guide or have any doubts, then do comment. I will be more than happy to help. :D
Genuine views are also welcome.
Stay inspired to rise.
Inspire2rise on Facebook | Inspire2rise on twitter
All rights reserved. 2011-13 ©Inspire2rise.com

Subscribe to Inspire2rise

Subscribe to Inspire2rise.com for latest awesome content delivered straight away to you as soon as it goes live!

Aditya Nath Jha is an engineering student from New Delhi, India. His areas of interest include Gadgets, WordPress, speed optimization & latest technology. When he is not busy blogging he loves to write poetry, compose his own songs and has a taste for music! Find me on Facebook, Google +, Twitter, Linked in. And watch my videos on Youtube.

93 Comments to The ultimate guide to W3 Total cache settings

  1. Hello Aditya Nath Jha,

    Thanks for your awesome article.

    i have one question. This W3 total cache setting is save for Adsense account?

  2. Hi i tried your set up on one of my site. yeah the speed is improved but in the page source I didn’t see the result as same in your screenshot.

  3. IceCreamTruck

    I've installed and configured W3 Total Cache on a few of my WP sites. The sites load faster but the problem now is that the Google Ads are not showing for me the first time I load the website. I need to reload the page for the ads to appear and I'm worried that's what the rest of the visitors are seeing. Last thing I want to happen is getting banned from Google for messing with the ads.

    I'm not sure what I did wrong. Currently, all I see is white space in the place where the ad should be. If I reload the page then the ads appear. Any help would be appreciated!

    • It happens when you clear the cache again and again, and server slows down because of over load caused due to excessive cache rebuild. Try avoiding clearing caches for atleast 8 hours and then check via another browser which has all history( cookies + caches ) cleared . Maybe it will solve the issue!

  4. Hello sir , i really liked your article….but do I need to do anything or any settings if I shift from Quick Cache to W3 Total Cache. I am using quick cache at present..so should change it directly.

  5. Thanks you sir, but I get a help from you please.
    I don't understand about "W3 Total Cache settings for Minify." for CSS and JS. In this case :
    "Find the CSS files, and add their urls one by one in the CSS minification box. Do this to see whether something breaks the layout on minification or not."

    What's mean? Can you give me a Screenshot for follow the tips? Thanks :)

    • It means that if a theme is developed by a bad coder then the CSS on minification would break the design, that's why you have to add the files one by one and then clear the caches to see whether the site layout stays constant or not!

  6. Hi Aditya,

    We have just completed this tutorial for our website born4digital.com as we were having some slow speeds on some pages. Our Pingdom score was a low 60 before we did this and now it has just come back as 72/100 – still not great but loads better thank you! Now to reduce the images sizes and the pages will be even quicker :)

    Thanks for the guide!

    • Try again with the above settings and remove any conflicting plugins, you will surely be in the 80s or 90s scores! Have a nice day! Keep visiting Inspire2rise.com

  7. Hi, great job. Your article is very professional, I have a question: is it possible to ignore the : "W3 Total Cache settings for Minify."
    Thanks

    • I haven't covered it because minify is too complicated for most of javascript and themes as it requires delicate trial and error. One wrongly minified file can break a whole site's layout!

      • I’ve used your tutorial twice now. Inserting all css files in minify.
        The first time everything worked perfect but now every css file I put in gets disabled.
        Do you have any idea what I’m doing wrong?

        • Maybe you have changed your theme, or maybe the W3 total cache plugin has been updated too much since the previous release you had been working with. CSS files don’t work with minify only and only if they have been poorly coded.

  8. i got this error,

    "W3 Total Cache error: It appears Page Cache URL rewriting is not working. Please verify that the server configuration allows .htaccess
    Unfortunately disk enhanced page caching will not function without custom rewrite rules. Please ask your server administrator for assistance. Also refer to the install page for the rules for your server.
    Technical info"
    i knw abt .htaccess file, bt the problem is I dnt know what to add.

  9. Your settings helped my speed up by 20%. But today I found this post on hostgator : goo.gl/2BZgXB
    They don't recommend W3 total cache. After I read that post I have changed to super cache and my speed was slow.
    Please give me a soln for this!

    • If you read the post carefully, it's written that: "We do not recommend using W3 Total Cache while any other caching plugins are enabled as it causes numerous issues upon activation." It means using only W3 Total Cache as cache plugin doesn't affect the W3 Total cache settings and then everything works fine!

  10. Hello! The article is really helpful and I think I’ve accomplished and followed all your instruction. I’ve also seen almost the same screenshot on the Page Source saying W3 is caching my website. I’ve installed W3 Total Cache before but deactivated because my website crashed and now that i have re-installed the plugin I am receiving this message:

    W3 Total Cache Error: Files and directories could not be automatically created to complete the installation.
    Please execute commands manually or use FTP form to allow W3 Total Cache make it automatically

    - – - – - – – - –
    I wonder if I really need to do this. if yes, how?
    Any help would be appreciated. Thank you in advance.

    • This seems a rather strange issue. I would recommend to uninstall W3 Total cache completely. Remove it’s rules from your .htaccess file and delete any advanced-cache.php file in your wp-content directory. And then try reinstalling the plugin.

    • Advice 1 never make too great changes when visitors are rushing in. Do it at a time when there’s less traffic. Advice 2 : Spend time yourself on these things, it will add to your knowledge :D

  11. And you all have to realize that W3 Total Cache can be a very moody plugin. Sometimes just adding a new plugin can set it off. It’s definitely very very trial and error.

    One thing I don’t recommend is paying for them to configure this for you as I made that mistake and $800 later I wound up just doing it myself. Their service kept crashing my server (massive dedicated one at that with SSD’s) and then they kept telling me my server was just wrong and I should switch to their servers.

    For sites that are very image heavy, MaxCDN might be a great choice as it takes the load off your server. It might not boost up speeds, but it takes the strain off the CPU to keep it busy for other things.

    It’s a great article for the latest update on W3 Total Cache. Most of the tutorials are from 2012 so it was great to find an up to date one. With Minify, tread carefully and slowly. Man would love to just make all the changes at once and save, but trust me, minify is that one that one little tweak can make it tweak out.

    • Wow man, so much frustration :P
      It’s visible everywhere in your comment. And you would have noticed that I didn’t cover minify in detail. Because personally I think that for most people it would be better not to try it. Only because some theme developers and plugin developers take shortcuts to do things is the reason why minify doesn’t work on all types of scripts. And yes this guide surely gets updated every once in a while. If I think something’s missing then either I update this W3 Total Cache settings post or I add the tip in a comment.
      Consider this newbie tip : Enable manual minify, and leave the ccs and js part. Just HTML minify too would lead to some savings on bandwidth and loading time. If you liked the W3 Total Cache settings post then do visit us again.
      Stay Inspired to rise Curt! :D

  12. Hi,

    The suggestions you have provided is very useful. I did not know very much about these settings. I have enabled the minify and now my site is bit faster. Is there any good optimization technique for images?.

    Thanks,
    Krishna

  13. i am new when i use w3 total cache and clear all browsing data the i go to my website nothing little emoticons and wired black text everything gone
    but when i deactivate the plugin my website starts visible
    please helppp

  14. Hello Aditya,

    An article worth sharing buddy. I applied these settings and saw a change as the score for mobile increased by 22 and that for desktop increased by 4. I was using W3 Total Cache Plugin earlier also, but this guide helped me in well optimizing it. Thanks for sharing bro. Cheers!!!

  15. Hi,

    It was really a great article and I have been trying to figure out things for a long time. After the steps which you have mentioned, I noticed that some of the versions have newer things which is not matching with the article. After completing all the steps, the score was great but I lost something valuable in the website. The pages were faster, but the image gallery in various pages never showed up. I have no clue as why this happened.

    It will be really a great, if you can help on this matter.
    Regards

    • It seems that the image gallery has a specific js file attached to it. While setting up W3 total cache settings you most probably enabled auto minify which is why those scripts are giving you the error. Set minify to manual and in that only enable HTML minify and leave JS and CSS minify part untouched. This works the best.

      • Hi Aditya,

        Yes, I am using a different plugin for the gallery part, its Justified image grid. But truly I remain clueless as what is going wrong, as after reading your comment I tried to do the same thing which you specified but still the error persists. As soon as I activate the W3 cache plugin all the galleries goes off.

        Regards

  16. I am having a shed load of trouble with the JS minify, it pretty much breaks every plugin lol also specify a vary encoding header is being a nightmare. Any help will be appreciated

    P.S why not email for replies on this site ?

  17. Hi Aditya nice explanation how ever you asked me about object cache and database caching I explained it on my write up why I don’t recommend using object caching on a shared hosting.

  18. This is regarding your ‘Cache settings for Minify’. Instead of painstakingly copying CSS stylesheets from the page source, Google Insights can be used which requires no registration and is free. They can be simply copied from there and pasted. Anyway, the post content is great. :)

    • I have had prior experience with Google Insights, sometimes the CSS stylesheets which are not being served from your page i.e. Something like a stylesheet for web fonts served via Google appears there and a user minifies it, then it would lead to size of the minified file getting larger and would have no apparent benefits. So, keeping in mind the general newbie nature of most of the people here the W3 total cache settings have been written accordingly.
      Nonetheless, have a nice day. Keep visiting Inspire2rise.com

  19. Thanks a lot that’s awesome. I first installed W3 Total Cache but it was way too complicated and I turned to Super Cache, while later on I found that I need more other plugins together with Super Cache to make me pass the web speed tests and then I went back to Total Cache. I followed your guide and my site speed got boosted a lot! much better than when using super cache. The only thing is I have to disable minify in General Setting page to have my map showing properly in my page. After all thanks!

  20. Hi Aditya

    First of all – thank you very much for this great guide. I am not technical at all, and although I had never used W# Total Cache before, I found it very easy to configure it based on your guide.

    I used tools.pingdom.com to test the result, as you recommended. Most of my results look similar to your, except for the load time. I hope you can help me understand why my result is so different?

    My results:

    Perf grade: 88/100 (yours is 92/100)
    Requests: 66 (your is 64)
    Load time: 4.78s (yours is 931 ms) —-> this looks like a big difference?
    Page size: 951kb (yours is 848.9kb)

    I really hope you can point me in the right direction, as I have no idea what the big difference means?

    Thank you
    Laura

    • Hey Mam,
      I can help you in speeding up your website. I run a free one time service – Cacheable, intended to help webmasters speed up their service. We analyze sites for bottlenecks in achieving maximum performance. Every hosting package needs different configurations and other stuff. Contact me here : http://i2r.in/adityanathjha

  21. Despite of the fact I have enabled HTTP (gzip) compression on the browser cache it still shows that a lot files are not compressed when I analyze the site on the google page speed.

    • Even if you enable gzip in W3 Total cache it won’t be able to compress all the files. The files that are not present on your server (scripts etc.) Are the ones behind this. The only solution can be combining them into a single file and then using wp_enqueue() or similar methods to load them.

      • Aditya,

        Checked the files which are shown as not compressed are present on the servers but still they are not compressed. Any clues?

  22. I just went through this guide step by step, but my site is still slow @ between 6-8 seconds. When using GTMetrix to test the speed… Under YSlow I still get a Grade of 0 for “Set Expires Headers”. Under Page Speed I only have 6/100 for “Defer Parsing of Javascript”. Total # of HTTP Requests 112.

    In the section of W3 Total Cache where we had to look at the source code and add the .js URL’s. I had to add 4 of 11 that I found, but only 4 because it seemed the other was not hosted on my site. But there was a dropdown menu there that said “Embed Location” and all of those 4 I has “Embed in ” chosen. Is that okay?

    I’d like to know what’s going wrong. Any help would be appreciated!

    • If grade 0 is present for set expires headers, then it means you didn’t set up Browser Cache part correctly. The .js files served from your site are the ones that have to be added in the minify section in w3 total cache, add them to load before tag ( closing body tag ), load them asynchronously in the loading method ( non blocking via async tag )
      I hope it helps. :)
      Otherwise contact me on i2r.in/adityanathjha

  23. Before:
    Minified using disk (User is logged in)
    Page Caching using disk: enhanced (User is logged in)
    Database Caching using disk (Request-wide User is logged in)
    Object Caching 20993/21018 objects using disk

    Load time – 7.38
    Page size – 2.0 MB

    After:
    Minified using disk (User is logged in)
    Page Caching using disk: enhanced (User is logged in)
    Database Caching using disk (Request-wide User is logged in)
    Object Caching 20993/21018 objects using disk

    Load time – 4.16
    Page size – 2.1MB

    I only can say, your tutorial worked! But i believe i maybe forgot some things that can increase the sitespeed more, is it possible for you to look at it? It’s for a Buddhist Organization.

  24. Just found your blog and read through it and all the comments. I’ve been having a very difficult time with my site’s performance. I’m even on MaxCDN. I have CloudFlare but I’ve been running into so many conflicts with it plus the use of Max CDN. I’m going to give this a try tomorrow and see what happens. I’m on VPS, not shared hosting, and have APC installed. I sent a message to you, but it will go in your “other” folder on FB. Kindly, Leslie

  25. Woow! Just what I need it. I was searching for something like this for ages! Finally I found it. I was looking for advanced settings and it was almost impossible. Thanks for the great post. Cheers.

  26. Hi can you help with my page? My website is around 1.6 mb and 3 seconds of loading. I got MaxCDN installed as well. I followed your whole tutorial, but the minify settings make my website even slower. Can you help me with configuring w3 total cache for my website right?

    • You can use W3 Total cache with pagespeed because pagespeed won’t optimize the activities happening on server side. Enabling browser cache, database caching and other tweaks on W3 along with Google pagespeed works great!

  27. Aditya — Thanks so much for this… Website speed increased significantly, but I get this error message…

    Recently an error occurred while creating the CSS / JS minify cache: File “/home2/seamimi/public_html/wp-content/cache/minify/000000/4b006/default.include.d6fcd5.css”

    I am using the Themeforests Me Gusta Theme, which is enables user generated content, and now people are unable to upload their content. I’ve done all your trouble shooting options for .js and .css minify sections (disabled line breaks, embed in , etc.). Do you have any advice?

    • I would suggest to do manual fine tweaking, remove the .js files ( one at a time ) to check which one breaks upon minifying to resolve the user upload issue, for the issue regarding the error message, I think it’s probably a w3 total cache error which will be rectified with future updates.

  28. Aditya is correct about that minify error. It’s just a goofy bug the developers of W3TC are still trying to figure out how to get it to not show up. It just means the cache has changed.

Your awesome views on this post!