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.
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.
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.
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.
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.
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.
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.
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.
- Set Last-Modified header
- Set expires header
- Set cache control header
- Set entity tag
- Set W3 Total Cache header
- Enable HTTP (Gzip) compression
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.
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.
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.
If you want support from the developers of this plugin and configuration guide, then you can purchase and verify your license key here.
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 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.
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.
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