Universally Documentation

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

Exclude link localization

By default, Universally rewrites internal links on translated pages to point to the translated version. For example, a link to /about on a French page becomes /fr/about. This ensures visitors stay in their language as they navigate.

Link localization applies to:

  • All <a href> links pointing to pages on the same domain
  • Canonical URLs (<link rel="canonical">)
  • Open Graph URLs (og:url, og:image, og:video, etc.)
  • Twitter Card URLs (twitter:image, twitter:player, etc.)

Use Exclude Link Localization to prevent specific links from being rewritten. The field is on the project’s Translation Rules screen. Enter one URL pattern per line.

When to Use

Some links should never have a language prefix added:

  • File downloads: /downloads/report.pdf should not become /fr/downloads/report.pdf
  • API endpoints: /api/v1/data must stay as-is
  • Admin pages: /wp-admin/ links should not be localized
  • Static assets: /wp-content/uploads/image.jpg should not be prefixed
  • External service callbacks: payment or auth return URLs
  • RSS feeds: /feed/ endpoints

Pattern Syntax

A pattern is matched in one of two ways, depending on whether it contains a *.

Without *, it is a substring match. If the URL contains the pattern anywhere, the link is left alone.

/wp-content/
/wp-admin/
/api/
/downloads/
/feed/

The pattern /wp-content/ matches any URL containing that string:

  • /wp-content/uploads/photo.jpg: excluded
  • /wp-content/themes/style.css: excluded
  • /about-wp-content/: also excluded (substring match)

With *, it is a wildcard match, anchored at both ends. * stands for any characters. A pattern ending in * is open-ended; otherwise the whole path has to match.

/api/*
*.pdf
/uploads/*.jpg
  • /api/* matches /api/v1/data and /api/, but not /public/api/v1
  • *.pdf matches any path ending in .pdf
  • /uploads/*.jpg matches /uploads/2026/photo.jpg

Wildcard patterns are the way to express "every PDF" or "everything under /api/" precisely. Note the difference from the substring form: because a wildcard pattern is anchored, it does not match just anywhere in the path.

Examples

WordPress sites

/wp-content/
/wp-admin/
/wp-includes/
/wp-login.php
/wp-signup.php
/wp-activate.php
/xmlrpc.php
/wp-cron.php
/wp-json/
/feed/
/comments/feed/

Note: These are configured automatically for WordPress sites. You only need to add custom patterns.

E-commerce

/cart/add
/checkout/
/webhook/
/downloads/

General

/api/
/assets/
/static/
/uploads/
/_next/

How It Works Internally

When Universally processes a translated page, it rewrites URLs in two ways depending on your URL structure:

Subdirectory mode (default)

Links are prefixed with the language code:

  • /about/fr/about
  • /blog/post/fr/blog/post

Subdomain mode

Where a project serves languages on subdomains, the host is changed instead of the path:

  • https://example.com/abouthttps://fr.example.com/about

Language subdomains are in a closed beta. See Subdomains and subdirectories.

Excluded patterns bypass this rewriting entirely. The original URL is preserved as-is.

Things to Note

  • External links (different domain) are never localized regardless of this setting
  • Anchor-only links (#section) are never localized
  • A link carrying an hreflang attribute is never localized, with no configuration needed
  • A CSS exclude selector only stops localization when it matches the link itself. A link nested inside an excluded container still gets the language prefix: its text stays in the source language, but its href is rewritten. To keep a specific link untouched, add its path here or put hreflang on the link
Was this helpful?