Caching Your Site
Caching stores a ready-made copy of your content so it can be served quickly without rebuilding it on every request. There is no single cache — your site benefits from several layers working together, from the visitor's browser all the way up to a global CDN. This guide explains each layer and how they fit together.
How the Caching Layers Fit Together
When someone visits your website, a request passes through several stages, and each stage can be cached to save work:
- Browser cache — The visitor's own browser stores static files locally so repeat visits skip the download entirely.
- CDN cache — A content delivery network serves cached copies from a location near the visitor.
- Full-page cache — Your server stores complete HTML pages so it does not have to run PHP for every request.
- Object cache — Frequently used database query results are held in memory.
- OPcache — Compiled PHP code is kept in memory so the server skips recompiling scripts.
You do not have to configure all of these by hand. The tools below cover most of them for you, but it helps to understand what each one does so you know where to look when something needs clearing.
Browser Caching with .htaccess
Browser caching tells visitors' browsers how long they may keep a local copy of static assets such as images, stylesheets, and scripts. On Apache-based hosting you set this in your .htaccess file at the root of your site. Add rules using the Expires and Cache-Control headers:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(jpg|jpeg|png|webp|css|js)$">
Header set Cache-Control "public, max-age=2592000"
</FilesMatch>
</IfModule>
With these headers in place, returning visitors reload far fewer files, which makes your pages feel noticeably faster and reduces bandwidth usage.
.htaccess through the cPanel File Manager and make sure hidden files are shown (Settings & Show Hidden Files). Keep a copy of the original before you change it so you can restore it if needed.
Server-Side PHP Caching (OPcache)
OPcache stores the compiled version of your PHP scripts in memory so the server does not recompile them on every request. It runs at the server level and is enabled by default on our hosting, so most sites benefit from it automatically with no configuration. If you switch PHP versions, OPcache resets and warms up again on the first few requests, which is normal.
Object Caching
Object caching keeps the results of expensive database queries in memory so your application can reuse them instead of querying the database again. For dynamic applications like WordPress, an object cache can significantly reduce database load on busy pages. WordPress caching plugins and AccelerateWP can enable a persistent object cache for you, so you rarely need to configure this by hand.
Full-Page Caching
Full-page caching stores the complete generated HTML of a page and serves that copy directly, skipping PHP and the database entirely for anonymous visitors. This is usually the single biggest win for content sites and blogs, because most visitors see the same pages. For WordPress, full-page caching is provided by AccelerateWP or by a caching plugin.
AccelerateWP for WordPress
AccelerateWP bundles full-page caching, object caching, and asset optimization into a single tool inside cPanel, tuned for our servers. If you run WordPress, it is the easiest way to enable most of these caching layers at once without installing and configuring separate plugins. See AccelerateWP for setup and options.
WordPress Caching Plugins
If you prefer to manage caching from within WordPress, popular plugins such as WP Super Cache, W3 Total Cache, and LiteSpeed Cache provide page caching, minification, and browser-cache rules. Use only one caching plugin at a time — running several together causes conflicts and unpredictable results. If you are already using AccelerateWP for caching, you generally do not need a separate caching plugin as well.
CDN Caching with Cloudflare
A content delivery network caches your static assets — and optionally your full pages — on servers around the world, serving each visitor from a nearby location. This cuts latency, absorbs traffic spikes, and reduces load on your origin server. Cloudflare is free to connect and works alongside your other caching layers. See Cloudflare caching for how to configure cache levels and rules.
When to Clear Your Caches
Caching is what makes a fast site look stale after an update: you change something, but visitors keep seeing the old copy until the cache expires. After making changes, clear the relevant caches so everyone sees the new version:
- Clear your page cache (AccelerateWP or your caching plugin) after editing content, themes, or layout.
- Purge the Cloudflare cache if you use it — purge only the changed URLs, or everything after a large update.
- Do a hard refresh in your own browser (Ctrl+Shift+R, or Cmd+Shift+R on macOS) to bypass your local browser cache while you check the result.
Still not sure which layer is holding onto old content? Open a support ticket and our team can help you track it down.