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 |
|
Rewrite to docs |
|
Per-locale blog |
|
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:
Copy the page and expand the source paths
Localize source paths to match the destination structure
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