Localized paths with rewrites and custom headers

Learn how localized paths work with rewrites and custom headers in Framer

Understand how localized URLs are matched in rewrites and custom headers, and how to keep your rules working when pages or locales change.

Localized paths at a glance

Localized paths include language prefixes (for example, /de, /pt) and translated slugs (for example, /blog/hello-world becomes /de/blog/hallo-welt).

In Framer, Rewrite and Custom Header rules match the final URL string visitors see. They do not reference an internal page ID. This means:

  • Your pattern must explicitly include every locale you want to match

  • Rules do not update automatically if you rename or move pages

  • Changes to localized slugs require manual updates

If you use “expand to all locales”, Framer generates a static pattern based on the locales available at the time you save the rule. If you later add or remove locales, update the rule and republish.

How this works with rewrites and custom headers

Paths are stored as string patterns. They are not linked to pages, so they will not update automatically after structural changes.

Key behaviors to keep in mind:

  • Patterns must include all locale prefixes you want to support

  • “Expand to all locales” creates a fixed pattern at save time

  • Targets in other projects are also string-based and do not sync automatically

Examples

Use these examples to understand how localized patterns are written and applied across different scenarios.

Use case

Pattern

Global header

/*

Section header

/(|/de|/pt)/pricing/*

Rewrite to docs

/(|/de|/pt)/docs/* → __P0__

Per-locale blog

/de/blog/:slug → another-project/de/blog/:slug

Redirects vs rewrites (localized)

Redirect targets account for localization, but the source is still treated as a plain string.

When moving a localized page, you can:

  1. Copy the page and expand the source paths

  2. Localize source paths to match the destination structure

  3. Create separate redirects for each locale

Choose the approach that best matches your site structure and scale.

SEO notes

Set canonical URLs in the origin project to the final domain where content is served.

Rewrites keep the browser URL on your domain, but canonical tags help prevent duplicate content issues and ensure search engines index the correct version.

Pitfalls and quick fixes

Common issues with localized rules are usually caused by small mismatches in patterns or missing locale coverage. Use the table below to quickly identify and resolve them.

Issue

Fix

Rule stopped matching

Update pattern and republish

Header missing on some locales

Add missing locale prefixes

New locale added

Update or re-expand patterns, then republish

If something isn’t working as expected, double-check your patterns and locale coverage—small mismatches are often the cause.

FAQ

  • Why doesn’t my rule update after I rename a page?

    Rules match URL strings, not page IDs. When a slug changes, the pattern no longer matches. Update the rule manually and republish.

  • What happens if I add a new locale after creating a rule?

    Existing rules will not include the new locale automatically. You need to update the pattern or re-expand it to include the new locale, then republish.

  • Can rewrites sync automatically across projects?

    No. Rewrite targets are string-based, even across projects. If the target path changes, you must update the rule manually.

Updated