How to use W3 Total Cache to make your WordPress websites faster

by Ahsan Parwez  August 2, 2017

The WordPress core is somewhat lacking when it comes to use of caching systems to decrease site loading time and use of server resources. Luckily, there are many well-known cache plugins available on the WordPress plugin repository that help to add different caching rules on your WordPress website.

W3 Total Cache WordPress

On Cloudways, we highly recommend using W3 Total Cache (W3TC) as it is fully-compatible with our hosting stack. (You may also use other caching plugins with similar settings.) In this guide, we will go through each of the settings that we recommend to our clients to use on their websites.

Each new install of WordPress instance on Cloudways comes with preconfigured W3TC. However, if you migrate your websites over to us and want to switch to W3TC as your caching plugin, then this guide is for you.

First, we will overview what settings we have available in the W3TC. For beginners, the settings might be confusing, so it is useful to know exactly what each option does.

Overview of W3TC Settings

Assuming you have installed and enabled W3TC on your WordPress website, you will see a new option in the Admin sidebar i.e. “Performance” under the General Settings tab. You will see different types of caching that can be enabled or disabled. Each widget type of area holds general settings for the caching and the type of caching method to be used.

General

You can toggle all caching types to enable or disable with a click, this area also has a Preview mode that you can use to preview the site with W3TC before going live with it.

General

Page Cache

This cache creates static copies of your otherwise dynamic WordPress pages. If it is not enabled, then on each page view on your site WordPress generates the page content by executing PHP and ending queries to the database.

When this setting is enabled, a static cached version of the page is served to users. It reduces the page load time and also decreases load on server resources, hence increasing your server’s capability to handle more traffic.

We recommend using APC on both PHP 5.6 and PHP 7.

Page Cache Setting

Minify

As the name suggests, this option enables minification of your CSS, JS and static pages. This isn’t a caching setting and will behave differently on different WordPress setups.

We recommend you test it separately. In some cases it will harm your website’s performance because the process of minification is server intensive.

Minify

Database Cache

Caching the database queries will reduce load on your server, hence server will have more resources to serve website to the incoming flow of traffic.

We recommend enabling this setting and selecting Memcached as the method for caching.

This will be particularly useful if you have a WordPress website that sends out a lot of database queries per page load.

Database Cache

Object Cache

Object caches are particularly useful for database intensive websites. Cloudways integrated Redis on their servers some time ago, thus we recommend keeping Object Caching setting off in W3TC as it doesn’t support Redis.

To use Redis object caching, follow this tutorial.

Object Cache

Browser Cache

Browsers these days cache the static content of websites to improve the user experience. In W3TC option of browser cache, we can add exceptions and expiry dates of the elements in the website.

We recommend you to enable it and then navigate to the Browser Cache tab and enable the following settings for maximum effect.

  1. Set Last-Modified header
  2. Set expires header
  3. Set cache control header
  4. Set entity tag
  5. Set W3 Total Cache header
  6. Enable HTTP (Gzip) compression

Browser Cache

CDN

Content Delivery Networks have become popular, especially for websites that get traffic from all over the world. CDNs, like MaxCDN and Cloudflare, are popular and you can easily integrate them with your WordPress website through the W3TC plugin.

CDNs serve the static content of your website from different locations rather than just your hosting server. This helps in reducing load on your server and improves the speed at which website is served to visitors coming in from different locations.

This is highly recommended for higher traffic websites targeting global traffic.

CDN

Reverse Proxy

Cloudways servers come with pre-installed Varnish cache. Varnish is a very powerful cache that caches entire content (that includes both static and dynamic content of your website) and serves that content to returning and even new visitors. This cache speeds up the HTTP requests and sits in front of Apache (web server).

In W3TC the Reverse Proxy setting is used to purge the Varnish cache whenever you make an update to your website. It is highly recommended to keep it enabled or else you would need to purge Varnish manually each time.

Monitoring

If you use New Relic, then you can connect it with your website just by entering the API of New Relic of your account. But this is not required as Cloudways servers come with a built-in New Relic account that you can access under the Server Management -> Monitoring -> Application.

Monitoring

Licensing

If you want support from the developers of this plugin and configuration guide, then you can purchase and verify your license key here.

Miscellaneous

Under this tab, you will find general options that you may want to use like the Google Page Speed dashboard. We recommend keeping the “Verify rewrite rules” and keeping other options unchecked.

Debug

Debug mode is particularly useful if you want to know which cache is working and how much effect it has on the pages. To view the debug information, view the source code of your website and navigate to end of the page. You will see the comments notifying you if cache is enabled, how many queries were cached, and how long it took to build the cached page.

Import/Export Settings

If you have a lot of websites and don’t want to go over the same process of setting up W3TC over and over again, you can easily export all your settings and import the settings into your other website.

Conclusion

There are many advanced settings that you can tweak to better optimize the W3TC. It all depends on various WordPress setups. Keep in mind that you could mess up the settings, which is why using the recommended settings will prove to be most useful for you.

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Ahsan Parwez

Ahsan is the Community Team Manager at Cloudways - A Managed Cloud Hosting Platform. He loves to solve problems and help Cloudways' clients in any aspect he can. In his free time, you can find him playing RTS PC games.

Stay Connected:

You Might Also Like...

  • DonChipriani

    Isn’t NGINX-Varnish already caching the database queries? Wouldn’t using TOTAL-CACHE database option be redundant? Thanks.

    • Hi Don,

      Varnish is caching the HTTP requests and for database queries we have Memcached. If a site is served from Varnish cache then there won’t be much work for Memcached to do. But for dynamic requests and repeated database queries that are generated are handled by Memcached.

      So, you need to have DB option enabled.

  • I am still trying to figure it all out. I recently transferred my site from HostGator using the migration tool Cloudways provides. It worked like a charm but in the process WP Super Cache was removed and substituted by W3 Total Cache. It seems W3 Total Cache is the top choice for many yet it hasn’t been updated in 5 month as of today.

    • Greg Perham

      W3TC has broken, in part or in whole, literally every site I have ever encountered it on as a maintainer.

  • Memcached isn’t available as an option for the Database Cache. The only option available is Opcode: Alternative PHP Cache (APC). Is there a server setting I’m missing or are these directions outdated?

  • Greg Perham

    Is your caching still incompatible with HTTPS?

  • BobTheBuilder

    W3TC now supports Redis. Do you recommend us to use W3TC Object Cache with Redis or continue using the separate Redis plugin while leaving object cache off in W3TC?