CodePark/ questions / Locale detection & routing
START PRACTICINGPRACTICE
Frontend question · Internationalization › Locale detection & routing

Why do most multilingual sites put the locale in the URL (/fr/pricing), instead of choosing the language only from Accept-Language or a cookie?

Each language version gets its own URL that search engines can index, people can share and CDNs can cache

When one URL can return many languages, search crawlers usually see only one of them. A shared link can also open in the wrong language. And a CDN must vary its cache by header or cookie. Separate URLs fix all three.

"Browsers stop sending
Accept-Language on HTTPS" is the tempting wrong answer, but it is false. Browsers send it on every request. Most crawlers just don't set it to the language you hope for. Use Accept-Language to pick the first redirect, then let the URL decide.