How to Make WordPress Faster with W3 Total Cache and Cloudflare
Exactly which W3 Total Cache settings to turn on, which to leave alone, and how to connect Cloudflare without the redirect loop that catches everyone.
W3 Total Cache is powerful and has hundreds of settings. That combination is why so many sites end up slower, or broken, after installing it.
This guide gives you the exact settings to enable, the ones to leave alone, and the Cloudflare configuration that avoids the redirect loop almost everyone hits once.
Before you install anything
Two checks, both worth a minute.
Is your host running LiteSpeed? Look in cPanel, or check the server header. If it is, install LiteSpeed Cache instead and stop reading here — it is free, faster than W3TC on that stack, and far simpler.
Do you already have a caching plugin? Remove it completely. Two caching plugins fight, serve stale pages and create bugs that are genuinely hard to trace. Deactivating is not enough — delete it.
Also take a backup. Caching plugins write to .htaccess and wp-config.php.
Part 1: W3 Total Cache
Install from Plugins → Add New, activate, and skip the setup wizard — we will set things deliberately.
General Settings: what to enable
| Setting | Turn on? | Why |
|---|---|---|
| Page Cache | Yes — Disk: Enhanced | The whole point. Serves saved HTML instead of rebuilding. |
| Minify | No, at first | Breaks more sites than it speeds up. Add later, carefully. |
| Opcode Cache | Yes, if offered | Free speed, nothing to break. |
| Database Cache | No on shared hosting | Disk-based DB cache often makes things slower. |
| Object Cache | No on shared hosting | Same reason. Yes on a VPS with Redis. |
| Browser Cache | Yes | Tells browsers to keep files. Big repeat-visit gain. |
| CDN | Later | Cloudflare is configured separately below. |
| Lazy Load | No | WordPress already does this. |
Save, then empty all caches from the top bar. Test the site now, before adding anything else.
Page Cache settings
Under Performance → Page Cache, enable:
- Cache front page
- Cache feeds
- Cache SSL (HTTPS) requests
- Don't cache pages for logged in users — essential, or admins see stale pages and editors get confused
If you run a shop, add the cart, checkout and account pages to Never cache the following pages. A cached cart shows one customer another customer's basket.
Browser Cache settings
Under Performance → Browser Cache, enable for all three sections:
- Set expires header
- Set cache control header
- Enable HTTP gzip compression
Minify — only after everything else works
This is where sites break. If you want to try it:
- Enable Minify in General Settings, mode Manual, not Auto
- Start with HTML only. Test the site.
- Add CSS. Test again.
- Add JS last, and test hardest — this is what breaks sliders, menus and forms.
- If anything breaks, turn JS minify off and leave it off. The gain is small.
Test in a private window. Logged-in pages are not cached, so you will not see the problem your visitors see.
Part 2: Cloudflare
Cloudflare serves your files from a location near the visitor, and gives free SSL and basic attack protection.
Set it up
- Create a free account at cloudflare.com and add your domain
- It scans your existing DNS records — check them carefully, especially mail records
- Change your nameservers at your registrar to the two Cloudflare gives you
- Wait for activation, usually minutes to a few hours
The SSL setting that causes the redirect loop
This is the one. Go to SSL/TLS → Overview.
| Mode | Use it? |
|---|---|
| Off | No |
| Flexible | No — this causes the loop |
| Full | Acceptable |
| Full (strict) | Yes, if you have a real certificate |
Flexible means Cloudflare talks to your server over plain HTTP. Your server sees an insecure request, redirects to HTTPS, Cloudflare forwards it again over HTTP, and round it goes. That is the "too many redirects" error.
Get a free certificate on the server first — see the WordPress SSL guide — then set Full (strict).
The rest of the Cloudflare settings
- SSL/TLS → Edge Certificates: turn on Always Use HTTPS and Automatic HTTPS Rewrites
- Speed → Optimization: enable Brotli
- Caching → Configuration: Caching Level Standard, Browser Cache TTL 4 hours or more
- Rocket Loader: leave off. It reorders JavaScript and breaks themes regularly.
- Auto Minify: leave off if W3TC is already minifying. Never both.
Stop Cloudflare caching your admin area
Go to Rules → Page Rules and add:
URL: yourdomain.com/wp-admin/*
Settings: Cache Level → Bypass
Add a second for yourdomain.com/wp-login.php*. Without these, logging in behaves strangely and changes appear not to save.
Connect Cloudflare to W3TC
Optional but useful: in Performance → Extensions, enable the Cloudflare extension and enter your account email and API token.
Once connected, clearing the W3TC cache also purges Cloudflare, which saves the "why is my change not showing" confusion.
Test it properly
- Open the site in a private window — logged-in pages are not cached
- Check a post, a page, the contact form, and the search
- If you have a shop, add something to the cart and reach checkout
- Run PageSpeed Insights on mobile
- Confirm
cf-cache-statusappears in the response headers
Common problems
"Too many redirects"
Cloudflare SSL is on Flexible. Change to Full (strict). This is the single most common Cloudflare problem.
The site looks unstyled
Minify broke the CSS. Turn Minify off, empty all caches, purge Cloudflare. Then reintroduce it one type at a time.
Menus, sliders or forms stopped working
JS minify or Rocket Loader. Turn both off.
My changes do not appear
Clear in this order: W3TC empty all caches, Cloudflare purge everything, browser hard refresh. Skipping the middle step is the usual mistake.
Logged-in users see the wrong content
"Don't cache pages for logged in users" is off. Turn it on, and add the page rule bypassing /wp-admin/.
The site got slower
Usually Database Cache or Object Cache on shared hosting. Turn both off.
WooCommerce shows the wrong cart
Cart, checkout and account pages are being cached. Add them to the never-cache list immediately.
Is W3 Total Cache the right choice?
| Situation | Better option |
|---|---|
| Host runs LiteSpeed | LiteSpeed Cache — free and faster |
| You want simple | WP Super Cache |
| You want control | W3 Total Cache |
| You want to pay for simple | WP Rocket |
W3TC is the most capable of the free options and the easiest to misconfigure. If the settings above feel like a lot, WP Super Cache gets you 80 percent of the benefit with four checkboxes.
And remember caching is only one part. If images are uncompressed or the host is slow, no caching plugin saves you — see how to increase WordPress speed for the full diagnosis.