[Guide] How to Setup W3 Total Cache Plugin?

dailydose

#1

W3 Total Cache is my go-to plugin. It does “WHAT EXACTLY I WANT”.

Notable websites who are using W3TC

  • WpBeginner
  • MakeUseOf
  • Sitepoint
  • Android Police

Data Source: Wappalyzer

Why W3TC is a best Caching plugin?

The unique advanced feature, flexibility and wide range of support is just awesome.


Overview

Pro

  • Advanced features and flexibility is mind-blowing. 5/5 for performance.
  • Compatible with Varnish, Cloudflare and more.

Cons

  • Too many settings may be confusing for beginner, but this is what makes this plugin so flexible.

Before you think about proceeding with below steps, please disable all other caching plugin. It is strongly advised to avoid using multiple caching plugins at WordPress.

Installation & Setup process

  1. Login to WordPress Dashboard example.com/wp-admin/

  2. Go to Plugins > Add new > Search for W3 Total Cache

  3. Install and Activate
    install-activate-w3tc

  4. Navigate to Settings > General
    w3tc-settings

  5. Feel free to click on Hide button to gracefully remove below header message.

  6. Preview mode: Don’t touch

  7. Enable Page Cache > Choose Page Cache Method > Disk Basic

  8. Minify: Don’t touch. Here are the 5 reasons why you shouldn’t minify.

  9. OpCode Cache: Don’t touch

  10. Database Cache: Disk

  11. Object Cache: Don’t touch

  12. Browser Cache: Enable

  13. CDN: Choose Generic Mirror (To add cdn.exmaple.com in next upcoming steps)

  14. Reverse Proxy: Must enable if are you using Varnish.


    Also, make sure to enter application path wordpress-xyz-abc.cloudwaysapps.com:8080 if you are a Cloudways user. Your App path is written at Applications > Domain management.

  15. In Miscellaneous, uncheck Enable Google Page Speed dashboard widget
    Uncheck%20Enable%20Google%20Page%20Speed%20dashboard%20widget

  16. Save Settings and Purge Caches. The general Settings completes here.

  17. Now please go to Page Cache menu of W3 Total Cache plugin.
    page-cache

  18. Check “Cache front page”

  19. Check “Cache feeds: site, categories, tags, comments”

  20. Check “Cache SSL (https) requests”

  21. Don’t touch “Cache URIs with query string variables”

  22. Don’t touch “Cache 404 (not found) pages”

  23. Please check “Don’t cache pages for logged in users”

  24. Check “Don’t cache pages for following user roles”.
    Tip: You may select user role - Administrator, Editor and Author" for whom you don’t want to mess up with cache

  25. Aliases: Leave it blank.

  26. Cache Preload: Please keep it unchecked.


    Edited: 4:32 PM IST 4/12/2018

  27. Purge Policy: Must check Front Page, Post Page, Blog Feed

  28. Save settings and say good bye to Page Cache option of W3TC. You will never need to visit here again.

  29. Directly jump to Browser Cache menu. Let’s configure it properly.
    options
    Browser cache is mostly controlled by a HTTP header called “cache-control” which instruct browser how to deal with particular file. Either to cache or not.

  30. Here, first we will see General Settings that will specify global browser cache policy. Well, you may override as per file type. That’s a unique flexible feature fo this plugin that no other popular cache plugin provides. Please refer to the image

  31. Let me explain in little bit what all those means. First is Last Modified, I recommend enabling it, helps Googlebot to do not aggresively crawl non-modified static resources.

  32. Set Expires header, generally used by proxy, to store web page, file in the cache memory for a particular time period. Please keep this disable.

  33. Set cache control header, used by browser, please keep this disable. Because keeping globally is not a good idea.

  34. Set entity tag (ETag), keep this option enable. It helps browser in validating cached file either to use or not.

  35. Set W3 Total Cache header, to keep thing white level you may disable this feature. This header doesn’t matter either its enable or disable.

  36. Enable HTTP (gzip) compression: You may enable this feature.

  37. Prevent caching of objects after settings change: Please don’t enable this. Else, it may increase your bandwidth usage by preventing proper browser cache. This feature should only be used if you faced some certain problem where you unable to override browser cache for static files.

  38. Remove query strings from static resources: Please don’t enable this. Enabling this feature will improve just grade by removing query strings like ver=?2.3 from the static files, this wont improve ctual load time (even little bit).

  39. Don’t set cookies for static files: Enable.

  40. Do not process 404 errors for static objects with WordPress: Notable feature by W3TC plugin which reduce server load for the 404. You might have seen that how a single 404 error some time takes a long time to load, this option reduce the impact by serving plain 404 page instead of fancy for static files like txt, jpg, etc. Don’t worry, this is not for normal pages. You should enable this feature, highly recommended by me.

  41. Rewrite URL structure of objects: Keep it uncheck.

  42. Apply HTTP Strict Transport Security policy: It’s good settings for caching “force HTTPS request”. Before enabling, please read here about HSTS.. If you are a beginner to WordPress, please do not enable this it may bring panic situtation when you miss SSL by chance. Browser will simply stop loading in HTTP or HTTPS unless you keep valid certificate.

So, this was general information about how caching works, for General Browser Cache Settings of W3TC plugin. Next, let’s move to specific settings of certain file types.

  1. Next, scroll down to CSS & JS. This settings will be valid only for CSS and JS and nothing else. Please refer to the screenshot.

  2. Now, for HTML the Browser cache settings should have little change. We know very well that our HTML (Document, in browser language) is a dynamic form of content. Be very careful. It’s better to don’t cache anything for HTML, neither it is recommended to do. If you keep expire 3600seconds, means, again W3TC will keep refreshing pages. That’s also bad. It’s better to avoid browser caching at all for HTML. I may explain this further in next upcoming post, why this settings means a lot for me.

  3. For Media elements, settings should be same as CSS and JS. Please refer to the screenshot.

  4. Next, there is one important settings - CDN. If you enabled “Generic Mirror” or CDN option in last General Settings page in early steps, you need to configure here now.
    cdn
    Warning: Please don’t touch any of these options, or you may invite some problem.

  5. A little scroll down at CDN page, you will see “General” settings. Please refer to the screenshot.

  6. General: Don’t check Add canonical header: Google doesn’t support it. Learn more, why so.

  7. Configuration: Scroll down, and enter your CDN path

  8. Advanced: Scroll down, enable Set cookie domain.

  9. CDN configuration done, Save Settings and Purge Caches.

  10. Now, navigate to Extentions menu of W3TC. Disable everything except Yoast SEO. This will point right CDN path for images in the Yoast XML Sitemap.

That’s all. I hope this helps. If anything I missed, because it was not required to follow that steps.

* Usual Disclaimer apply.

#DailyDose

if you have any question, please let me know.

Thanks & Regards,
Gulshan


How to Fix W3 Total Cache Fatal Error which comes while Purge
Redirection Wordpress plugin- need some info
[Guide] How to Setup WP Super Cache Plugin?
5 reasons we don’t need to combine CSS/JS files with HTTP/2
[Guide] How to Setup WP Rocket Cache Plugin?
Why my website is slow?
How to Install and Setup Breeze WordPress Cache Plugin?
Migrate WordPress from Cloudways to Vultr with ServerPilot (In 1 hour)
Migrate WordPress from Cloudways to Vultr with ServerPilot (In 1 hour)
BunnyCDN - Review of Lightning fast CDN
Speed Up WordPress (Quick & Simple in 5 Steps!)
Why Server Response Time Goes Slow After SSL Setup
How to Install and Setup Breeze WordPress Cache Plugin?
W3 total cache vs WP Rocket
W3 total cache vs WP Rocket
(Bihari Moderator) #2

Is W3 Total Cache better than Breeze on Cloudways?


#3

In my humble opinion, yes.


(Saksham Kumar) #4

Thank you so much. I am going to set it up now. :smiley:


#5

You’re welcome! There may be already done. :slight_smile:


(Saksham Kumar) #6

For other sites… :sweat_smile:


#7

Ya, you can. :slight_smile:


#8

W3TC is flexible, comes with wide range of supports that Breeze can’t provide. More than that, I hate stupid policy of Browser Cache which is done by Breeze. So, I am afraid.


(Bihari Moderator) #9

Memecache for example!


#10

W3TC Supports well.


#11

Feeling relax now. :slight_smile:

Next, I will be publishing configuration for WP Rocket.


(Bihari Moderator) #12

and WP Fastest cache too :stuck_out_tongue:

A before/after comparison between these four would be awesome :smiley:


#13

No need of comparison. I am 110% sure, W3TC is real boss of all cache plugin. Other plugin need to get inspired from it.

Youhin iska Naam W3 Total Cache nahi hai. :stuck_out_tongue:


(Wands Blog) #14

Really? Better than wprocket? Wish I hadn’t paid for it a few weeks ago.

Thank you for this tutorial.


#15

You may ask for refund. My review is coming soon. Just writing on it.


(Saksham Kumar) #16

And if we are not using any CDN then?


(sandi) #17

do check wp fastest cache plug-in as well.


#18

WP Fastest cache, I had tried. Will check again.


(Myil Raj) #19

@gulshankumar I tried installing this plugin and completed setup on one of my client domain. Before installing the plugin I tested the site with WPT and the results are as follows:
Load time: 1.960 s
First Byte: 1.749 s
F A A A C Ok

After installing and configuring, I purged the content and tested again with WPT and got the following results:
Load time: 1.942 s
First Byte: 1.799 s
F A A A C Ok

I can’t find any significant changes in page load time.


#20

May I see the test report?