After all the years, W3 Total Cache is still a formidable caching plugin. But it's not the easiest to configure. With over 12 pages of options, many have crashed their sites due to improper setup, so I'm going to show you how to configure W3 Total Cache for a lightning fast site.
Scores and grades do not equal speed. My biggest concern is to ensure great user experience.
It doesn't matter to me whether a page takes 0.5 seconds or 8 seconds to fully load as long as the user is faced with meaningful above the fold content in under a second. In other words, the first contentful paint must be lightning fast. In the background, the page can complete loading all of the elements. This concept is known as perceived load time and it's imperative to retain users on your site.
To achieve this, you'll need great hosting and a fast caching plugin.
Hosting is still the #1 speed factor as confirmed by this WordPress optimization support article.
I'll touch on this later on but you can jump to it if you want to read about it now.
You may be able to get inconsistent bursts of speed with certain hosts but if you want consistent speed, backed with the finest speed technology money can buy, I can only recommend Siteground.
What You Can Expect
With the right W3 Total Cache settings and decent hosting, this is what you could expect to see.
- Server response (time to first byte): 51ms.
- Contentful paint: 252ms (pretty fast!).
The contentful paint time is the time it takes for the first bit of content to appear on the page and for a user to believe the page is fully loaded (perceived load time).
- Preview Mode - enable this to preview your site to ensure that your changes don't affect layout and functionality.
- Page Cache - enable to cache your site's pages and posts.
- Opcode Cache - caches PHP files to enhance speed. Enable this in order for W3TC to update the cache with each file request, thereby saving PHP from having to be restarted.
- Database Cache - Enable to cache database objects. This reduces database calls and increases speed.
- Object Cache - I would leave this alone. It is known to slow down your backend.
- Browser Cache - Enabling this allows various data to be cached in the user's browser. This increases speed tremendously because certain assets don't have to be requested from the server with each visit to a page or post. NOTE: this only benefits repeat visitors.
- CDN - allows you to enable the use of a CDN. Please don't spend money on a CDN unless you're using a good WordPress hosting provider.
- Reverse Proxy - for servers that run Varnish.
- Network Performance & Security By Cloudflare - please enable Cloudflare from the Extensions tab.
- Fragment Cache - reduces execution time for certain common operations.
Page Cache Settings
- Enable Caching for home page, feeds and SSL requests.
- Don't Cache Pages For Logged In Users - it is recommended by the developer that this be enabled.
- Don't Cache Pages For Certain User Roles - choose which user roles should not receive cached pages.
- Cache Preload - the same as a cache warmer. This preloads the cache in order to always deliver cached pages to visitors, thereby enhancing user experience. Personally, I would recommend that you disable the automatic option because this will unnecessarily use server resources when not needed. I would also limit pages to 3 for shared hosting. Enable preloading upon published events.
- Purge Policy - developer recommends to leave settings as per defaults so as not to degrade server performance.
- Rest API and Advanced Settings - leave alone.
- Rewrite URL Structure - Enable.
- Disable Minify For Logged In Users - your choice but I like to disable minification for logged in users.
- CSS - Enable and combine CSS files.
Database Cache Settings
Leave as per defaults.
Object Cache Settings
Leave as per defaults.
Browser Cache Settings
- Set Last Modified Header - Enable.
- Set Expires Header - expires headers instruct the user's browser exactly what assets to cache and how long to keep them cached before automatically clearing them.
- Set Cache Control Header - enable to encourage caching.
- Set Entity Tag Header - enable.
- Set W3 Total Cache Header - assists in identifying optimized files.
- Enable GZip Compression - very important as this compresses files for reduced size and increased speed.
- Remove Query Strings From Static Resources - enable to normalize caching of resources that contain a ?
- Don't Set Cookies For Static Files - Enable.
- Do Not Process 404 Pages - do not check this. Caching of 404 error pages reduces server load especially if have many of them.
- CSS And JS - enable everything here except for prevent caching after changing settings. The settings here are pretty much the same as for the general options.
- HTML And XML - enable everything. Settings are the same as for CSS and JS.
- Media And Other Files - enable everything except for preventing settings changes. Settings are the same as for general settings.
- Host Attachments - enable to host all attachments with the CDN, e.g. images, download files.
- Host wp-includes Files - enable.
- Host Theme Files - enable this to host your theme files.
- Host Minified CSS and JS Files - enable to offload these assets to CDN.
- Enable custom files and canonical header.
- Configuration: Objects - This is for Stackpath Signup. It will be a heck of a lot easier to sign up separately with Stackpath and then return to the settings screen to complete your link up. I'd also really appreciate the business. It helps to keep the lights on! Stackpath will cost you $10 per month.
- Configuration: Full Site Delivery - this is for Cloudflare. Best is to access Cloudflare through your Siteground user area or cPanel. It's really easy to get it set up that way. The following screen is for W3TC Cloudflare options followed with my page rule for insane speed.
- Advanced Options - enable CORS header.
First authorize your Cloudflare. You can find your global API key in your Cloudflare account > Profile Settings.
- Development Mode - enable to be able to make changes to your live content. Otherwise you will be making changes to the cache.
- Rocketloader - set to ON.
- Minify JS, CSS and HTML - enable for all.
- Server Side Exclude - enable.
- Email Obfuscation - allows you put your email address on your page but encrypt it for bots so you don't get spam.
- Hotlink Protection - prevents others from linking to your images and displaying them on their websites. This chews up your bandwidth because they're served from your server.
- Browser Integrity Check - enable.
- Always Online - enable. If your server goes down, pages will still be served to visitors from the Cloudflare cache.
- DDos Protection - enable. Protects your site from attack.
- Cloudflare IP - enable IP Geolocation and IPV6.
- SSL - very important to enable Full (https everywhere).
Cloudflare Page Rule
This page rule reduces server response time tremendously. I'v seen a change from over 200ms to below 50ms. Contentful paint times also reduce to levels that you've never seen before thereby enhancing perceived load times and user experience concomitantly.
Why I recommend Siteground
Whether you want to believe it or not, Google pretty much controls the internet.
Because faster sites improve user experience considerably, site speed is now a major ranking factor.
Speed optimization doesn't begin and end with installing a caching plugin. It's the culmination of a number of very important factors. Some of these are mentioned in the WordPress Optimization Guide, with hosting being first.
The most crucial speed factor is hosting. #2 is a lightweight theme and #3 is caching. All other optimizations follow on from these.
Caching will certainly provide an immediate speed boost but in order to see consistently great speeds, fast hosting is crucial.
I've hosted sites with over 7 different hosting companies over the years. I've experienced all sorts of problems and the only one I can recommend without a hesitation of a doubt, is Siteground. It's not only blazing fast but you'll get the best value for for money hosting in the marketplace.
Here are some of Siteground's top features.
- Recommended by WordPress.
- GUARANTEED 99% up-time. I've had 100% over last few years.
- Brilliant service levels.
- EASY to configure.
- Phenomenal speed technology.
- Always up to date with latest technology.
- 4 Data center locations.
- FREE 1-click Cloudflare integration - expands data centers and enhances speed.
- 1-Click staging environment and 1-click push to live.
- 30 DAY (NO FUSS) MONEY BACK GUARANTEE.
I hope that these W3 Total Cache settings have helped you to configure your site for maximum speed.
I have shown the settings that work best for my website. But not all themes and sites are equal.
If there are any W3 Total Cache settings that you have found to be more effective than the ones I have shown, please let me know about them in the comments.
Hope you enjoyed this post.