Topic · Routing
Five ways to carry a locale. Choose the URL policy your app needs.
A cookie, a path prefix, a subdomain, a top-level domain, or an explicit language domain: Palamedes supports all five policies. TLD mode changes product.com to product.de. Explicit language domains also support unrelated names, such as my-product.com and mein-produkt.de.
01 — The problem
The decision people make by accident
Most teams pick a strategy from whichever tutorial they read first, then discover the consequences at the point where changing it means rewriting URLs that are already indexed. The options differ on shareability, on how cleanly a CDN can cache each variant, on how much DNS and certificate work you take on, and on whether a search engine can even see the localized versions.
02 — The approach
Headless controls, and your router keeps the URLs
Palamedes deliberately does not own routing. It resolves the locale and gives you the controls; the URL structure stays with the framework you already chose.
Resolution is separate from routing
Locale resolution, the deliberate-choice cookie and URL helpers are headless. canonicalUrl() builds language links; seoLinks() returns canonical, language alternate and x-default descriptors using the same policy. Your app renders those links, and changing strategy does not touch your messages.
Your router stays framework-native
There is no wrapped Link, no proprietary navigation layer and no middleware you inherit from us. You wire slightly more at the start; in exchange you keep your routing knowledge, and moving framework does not mean relearning navigation.
Verification coverage is explicit
The framework matrix covers cookie, route prefix, subdomain and TLD. All 25 examples are smoke-checked on relevant PRs and main pushes; 25 browser-capable examples run the real-browser contract weekly or on manual dispatch. Explicit language domains and SEO links have focused core contract tests; they are additional capabilities outside that four-strategy matrix.
03 — Evidence
Five strategies, with two distinct domain policies
TLD mode derives the next hostname by replacing its final DNS label. Explicit language domains select the entire destination from a configured map. Both keep paths free of locale prefixes; choose TLD when only the suffix changes, and explicit domains when you need full control over the hostnames.
- Cookie
- One URLSimplest to run, but a shared link carries no language and search engines see a single page per route.
- Route prefix
- /de/…The pragmatic default: indexable, shareable, no DNS work, and it fits inside one deployment.
- Subdomain
- de.example.comClean separation and per-locale caching, at the cost of DNS records and wildcard certificates.
- Top-level domain (TLD)
- product.deproduct.com to product.de: replace the final DNS label and keep the rest of the hostname. Configure exceptions such as .com mapping to English.
- Explicit language domains
- mein-produkt.demy-product.com to mein-produkt.de: map every locale to a distinct complete hostname. Names can differ, and configured destination ports are preserved.
04 — Questions
Questions people actually ask
Answered here rather than buried three pages into the documentation.
- Which locale routing strategy is best for SEO?
- Route prefixes, subdomains, TLDs and explicit language domains give each locale a distinct URL. A cookie-only strategy uses one URL for multiple languages. seoLinks() derives canonical, language alternate and x-default descriptors from the chosen URL policy; your app renders them and decides which pages are available in each language.
- How are TLD and explicit language domains different?
- Use hosts.mode: "tld" for product.com and product.de: only the last DNS label changes. Use hosts.mode: "domain" for my-product.com and mein-produkt.de: every locale has an explicitly configured complete hostname. Both omit locale path prefixes. Existing TLD sites can keep their current strategy.
- Is domain mode the same as the existing host map?
- No. hosts.mode: "map" adds advisory host checks to route-based resolution and keeps /en/... or /de/... paths. hosts.mode: "domain" makes the configured hostname authoritative and emits paths without locale prefixes. Moving an existing prefixed site to domain mode changes public URLs and needs redirects owned by your app.
- Subdomain or path prefix?
- A path prefix keeps everything in one deployment with no DNS work and is the pragmatic default for most teams. Subdomains buy cleaner per-locale caching and isolation, and cost you DNS records plus a wildcard certificate.
- Can I change strategy later?
- The translation side is unaffected — messages, catalogs and identity do not depend on where the locale lives. What is expensive is the URLs themselves, since anything already indexed or shared needs redirects. That is why the decision is worth making deliberately.
- Does Palamedes provide the routing?
- No, on purpose. You get headless locale resolution, a deliberate-choice cookie and canonical URL helpers; your framework's router owns the URLs. If you want localized pathnames as a library feature, next-intl covers that ground and we say so on the page comparing the two.
- How do I know these actually work?
- Cookie, route prefix, subdomain and TLD have running example apps per framework — 25 in total — smoke-checked against workspace packages on relevant PRs and main pushes. 25 browser-capable examples run Playwright weekly or on manual dispatch; 20 UI-adapter examples have versioned screenshots. Explicit language domains and SEO links have focused core contract tests, without a separate framework demo column.
05 — Keep reading