Universally Documentation

Step-by-step guides, multilingual SEO tips, and best practices to help you translate and scale your WordPress website.

Caching and CDNs

Caching plugins and CDNs work with Universally, and you should use them: a cached translated page is the fast one. Each language is its own URL, so a cache that keys on the URL separates them without any configuration. There is one page that needs an exception, and it is the source-language one.

Each language is already a separate cached page

/fr/pricing/ and /es/pricing/ are different URLs, so a page cache or CDN stores them separately by default. Nothing reads a ?lang= parameter, and language never travels in a header: it is in the path, or in the hostname if your project serves languages on subdomains.

That means there is no vary rule to add and no cache key to customise for translated pages.

The exception: unprefixed URLs

A visitor who has viewed a translated page carries a universally_lang cookie for 30 days, and a request to a URL with no language prefix is redirected to their language. That decision is made by your site on each request. See Existing URLs and redirects.

A full-page cache serves stored HTML without running that code, which breaks it in one of two ways:

  • The redirect stops happening. A returning visitor lands on the source-language page instead of theirs. Harmless, but the feature is gone.
  • The redirect itself gets cached. Now every visitor at that URL is sent to one language, including first-time visitors and crawlers. This is the bad one.

Configure one of these in your caching plugin or CDN:

  • Exclude requests that carry the universally_lang cookie from the page cache, which is the usual setting and the least disruptive, or
  • Exclude your unprefixed source-language URLs from the page cache, or
  • At minimum, never let the cache store a 301 or 302 for a shared URL

Translated URLs need none of this. They are static per language and safe to cache aggressively.

After a change

Clear caches outwards: Universally first, then your page cache, then your CDN. A translation edit that is not showing up is almost always held by one of the outer two. See Clear cache and refresh translations.

Adding a language needs no purge. Its pages have never been cached.

Was this helpful?