Content Negotiation vs Explicit URLs
You'll learn: When to rely on automatic language detection through HTTP headers versus encoding locale explicitly in your URLs.
The Core Trade-Off
You've already worked with Accept-Language headers and path-based locale routing. Now comes the architectural decision: should your application automatically detect language (Accept-Language → serves localized content at example.com/products) or require explicit locale paths (example.com/en/products)?
Content negotiation means the server inspects the Accept-Language header and returns content in the detected language without changing the URL. One URL, multiple language versions.
Explicit URLs mean each locale has its own distinct URL path (/en/, /fr/, /es/), making language part of the resource identifier itself.
When to Use Content Negotiation
- APIs where clients specify preferred language but URLs represent resources, not presentations
- Internal tools with homogeneous user bases where everyone shares language preferences
- Simple sites with minimal SEO requirements and single-language user sessions
When to Use Explicit URLs
- Public-facing websites where users share links across different language communities
- SEO-critical applications requiring distinct, crawlable URLs per language version
- Bookmarkable content where users must return to the same language version reliably
- Multi-language teams collaborating via shared URLs
- Social media integration where link previews must match the target language
Why Explicit URLs Win for Most Web Apps
A link to example.com/products with content negotiation becomes ambiguous: French users see French, English users see English. When they share that link, the experience breaks. Explicit example.com/fr/products eliminates ambiguity—everyone sees French, regardless of their browser settings.
Key Takeaway: Use explicit locale URLs for user-facing websites where link sharing and SEO matter; reserve content negotiation for APIs and contexts where URLs represent language-agnostic resources.