Skip to content

08Website know-how & errors

Understanding caching – clear browser, Redis, DNS and Cloudflare

Why you still see the old page after a change at Nexthosting – which caches exist (browser, page cache, Redis, DNS, Cloudflare) and how to clear each one.

In short

A cache is a temporary store that remembers answers so everything goes faster. The catch: after a change, the old version may still be sitting somewhere. Between the server and your screen there can be up to five caches. Clear them from the inside out: WordPress and server, then CDN, then DNS and finally the browser.

Building a page takes work: PHP runs, the database is queried, images are loaded. Delivering a finished copy saves time and computing power. That is why there are several temporary stores one after another.

The path of a page – and where it is remembered along the way
  1. Browser cacheYour device remembers files
  2. DNS cacheAddress of the domain remembered
  3. CDN or proxye.g. Cloudflare
  4. Page cache on the serverFinished HTML
  5. Object cache (Redis)Database results
  6. PHP and databaseThe "real" page
Cache Where? What is remembered? Typical problem
Browser Your device Images, CSS, scripts, whole pages Old version after a change
DNS Computer, router, resolver Address of a domain (TTL) Old page after a move
CDN/proxy (e.g. Cloudflare) Third-party servers Files, possibly pages Old files, 52x errors
Page cache Server or plugin Finished HTML pages Changes appear with a delay
Object cache (Redis) Server Database queries Old settings or menus
OPcache Server (PHP) Compiled PHP code A changed PHP file does not take effect immediately
You see an old version – who else still sees it?
Others too, after a change to the websitePage or object cache, possibly CDN
Others too, after a move or DNS changeDNS, wait for the TTL
52x error displayedCloudflare

A quick test without deleting anything: a private window (Ctrl+Shift+N or Ctrl+Shift+P) or another browser.

  • Windows and Linux: Ctrl+F5 or Ctrl+Shift+R
  • macOS: Cmd+Shift+R

This reloads the page without stored files.

With the browser cache, the server decides with headers how long it applies (Cache-Control, Expires). An example of how to set this up is in .htaccess basics. The status code 304 Not Modified means: the browser asked whether anything had changed and used its stored copy (HTTP status codes).

A cache plugin or a server feature stores finished pages. After a change the cache has to be cleared; often this happens automatically on saving. Otherwise:

  1. In WordPress, open the menu of your cache plugin.
  2. Click Clear cache (depending on the plugin “Purge All” or similar).
  3. Also clear the minify/CSS cache if styles do not appear.
  4. Reload the page in a private window.

Use one cache plugin, not several at once.

The object cache remembers the results of database queries. Nexthosting WordPress hosting includes Redis in every plan; with web hosting it is available from the Pro plan. It speeds up dynamic pages but can deliver old values, such as menus or settings.

  • Clear it through the Redis plugin in WordPress (“Flush Cache” button).
  • Via SSH with WP-CLI:
Terminal window
wp cache flush

PHP stores compiled code. The server usually detects new files by itself after a short time. If a changed PHP file stubbornly has no effect, a PHP restart in the web panel (if offered) or a note to support helps.

DNS answers are remembered for as long as the TTL allows. After a move, some visitors therefore still see the old page.

DNS change and cache
  1. Before the changeLower the TTLe.g. to 300 seconds
  2. ChangeSet the new record
  3. Until the TTLMixed phaseOld and new answers
  4. AfterwardsEveryone sees the new pageRaise the TTL again

Clear the local DNS cache:

Terminal window
ipconfig /flushdns

More in DNS basics and Solving DNS problems.

If your domain uses Cloudflare as an intermediary, there is another cache there.

  1. Log in to Cloudflare and choose your domain.
  2. Open Caching, then Configuration.
  3. Choose Purge Everything or purge individual addresses (Custom Purge).
  4. During development you can switch on Development Mode: the cache is bypassed for three hours.

Also check the SSL mode (recommended: “Full” or “Full (strict)”), otherwise redirect loops threaten. Errors 520 to 526 come from Cloudflare (HTTP status codes).

With curl you can see headers that point to a cache:

Terminal window
curl -sI https://meinprojekt.de/ | grep -iE "cache|age|etag|last-modified|cf-cache-status"
Header Meaning
cache-control How long may it be stored?
age For how many seconds has the response been in the cache?
etag, last-modified Version markers so the browser can check back
cf-cache-status: HIT Cloudflare delivered from its cache (MISS = fetched fresh)
  1. Clear the WordPress cache plugin and the object cache.
  2. If present: clear Cloudflare or another CDN.
  3. Clear the browser cache or use a private window.
  4. For moves: clear the DNS cache and wait out the TTL.

No. Without a cache the site gets slower. Only switch it off for testing or clear it selectively.

Why do I see changes in the admin area but not on the site?

Section titled “Why do I see changes in the admin area but not on the site?”

Usually the page cache or the CDN sits in between. Clear both.

Game servers do not use web caches. With server pages and banners, however, the browser can show old images.