Why the Same Website URL Shows Different Languages

Find out why the same URL shows different languages to different users, and troubleshoot browser preferences, cookies, redirects, and CDN caching.

Published
Reading time
7 min read
Why the Same Website URL Shows Different Languages
On this page

The same URL can show different languages to different users because a website selects a language from browser preferences, a saved choice, an account setting, or another signal. Caches can complicate the picture by storing and serving a response selected for an earlier request.

This guide helps website owners distinguish intentional language selection from a cache configuration problem and reproduce the difference with simple requests.

Key Takeaways

  • Check whether the server redirects visitors to language-specific URLs or returns different content at the same URL.
  • Accept-Language communicates language preferences, but visitors may send different values or no header at all.
  • A response selected using Accept-Language may need Vary: Accept-Language so caches know that header affects response selection.
  • Cookies, account settings, CDN rules, and client-side translation can also explain differences. Test them separately.
  • Changes to cache configuration may require invalidating older cached responses before retesting.

How websites select a language

Start by identifying which mechanism your site uses. More than one may apply, so determine which choice takes precedence when signals disagree.

MechanismWhat happensWhat to check
RedirectA request to / receives a redirect, such as to /fr/.Inspect the redirect status and Location header, then check what happens on the destination page.
CookieA language switcher or earlier visit saves a preference that affects later responses.Compare a fresh request with one carrying the preference cookie.
URL pathA language is encoded in the address, such as /en/ or /fr/.Compare the final URLs, not just the address initially entered.
Accept-LanguageThe server chooses a representation based on a request header containing preferred languages.Send requests with different header values and compare responses.

A site may redirect a new visitor based on Accept-Language, then use a cookie for later visits. It may also use an account preference, an approximate geographic signal, a default language, or JavaScript after the page loads. A browser translation feature can change what a user sees without changing the server's response.

Accept-Language can express multiple languages and relative preferences. Browser settings, operating-system settings, privacy controls, and other factors can affect what is sent. Do not assume every browser sends the same data, or that the header alone identifies a visitor's location or nationality.

This article could not be checked against RFC 9110 or current browser documentation in this run. Confirm HTTP details and the relevant browser's current language-setting instructions against those sources before publication or implementation.

Advertisement

Reproduce the language difference

Run the following from a terminal with curl installed. Replace the example address with a public URL you own or are authorized to test. Use a page whose language you can recognize in its HTML; do not include credentials or private URLs.

URL='https://www.example.com/'

curl -sS -D en.headers -o en.body \
  -H 'Accept-Language: en' "$URL"

curl -sS -D fr.headers -o fr.body \
  -H 'Accept-Language: fr' "$URL"

cat en.headers
cat fr.headers

The -D option saves response headers, while -o saves the response body. These requests do not follow redirects, so they let you inspect the initial response first. The commands were not executed for this article; results depend on your site and its configuration.

Compare the two header files and bodies:

  1. Status and Location: If either response is a redirect, compare its destination. Request each destination separately to inspect its response too.
  2. Content: If both requests return a page at the same URL, open or search the body files for recognizable text. An HTML lang attribute can be a useful clue, but verify the visible content as well.
  3. Vary: Look for Accept-Language in the Vary response header when the response changes based on that request header.
  4. Caching headers: Compare Cache-Control, Age, and any CDN-specific cache-status headers your provider documents. A missing Age or cache-status header does not by itself prove a response bypassed the cache.
  5. Cookies: Look for Set-Cookie and consider whether a preference is being assigned. These separate curl requests do not automatically preserve a cookie from one request to the next.

If the HTML is the same but users see different languages, inspect the fully rendered page and its network requests in browser developer tools. A script, a later API response, or browser translation may account for the difference. The command-line comparison alone cannot reveal all client-side behavior.

Check the language switcher

In a fresh browser session, select one language with the site's switcher and observe the address, cookies, and network requests. Then reload the page and open it in a separate fresh session. Check whether the selection:

  • Changes the URL, sets a cookie, updates an account preference, or calls an API.
  • Survives a reload and whether it should survive a new session.
  • Overrides the browser preference as intended.
  • Applies consistently to redirects, page content, and later requests.

Use test accounts where needed. Avoid copying session cookies or other credentials into shared tickets or logs. Also check the behavior when a chosen language is unavailable and when no preference is supplied.

Understand Vary and cache behavior

A shared cache, such as a CDN, may store a response and reuse it for later visitors. If a server returns different content at the same URL based on Accept-Language, the response can include:

Vary: Accept-Language

This tells caches that the request's Accept-Language value matters when selecting a stored response. For example, an English response selected for an English preference should not simply be reused as the matching response for a French preference. The same consideration applies to a cacheable redirect whose destination changes with that header.

Vary does not itself make a response cacheable or guarantee that a CDN is configured to respect it. Conversely, a missing Vary header does not automatically prove a bug: the response may be uncacheable, bypass a shared cache, use distinct language URLs, or be handled by a correctly configured cache key. Investigate the actual selection and caching rules together.

If language depends on a cookie or signed-in account, varying only on Accept-Language does not distinguish those choices. Avoid treating personalized responses as safely shared just because a language header is present. Configure appropriate cache controls or bypass shared caching for those responses; if caching by cookie is necessary, review the CDN's supported cache-key rules and privacy implications. Varying on an entire cookie header can also create many cache variants.

Advertisement

Check the CDN and retest

Review the configuration for the exact hostname and path under investigation:

  1. Identify the cache key. Determine whether the CDN includes or normalizes the language signal, and whether its behavior agrees with the origin's Vary and cache-control headers. Provider-specific settings can override assumptions made from origin headers.
  2. Inspect redirect caching. A cached redirect can send visitors to the wrong language path even if the destination pages are correct. Check caching and variation on the redirect response separately.
  3. Check cookie and account handling. Confirm that a saved preference or personalized response cannot be served to another user through a shared cache.
  4. Compare origin and CDN behavior where authorized. If you have a safe way to reach the origin with the correct host configuration, compare its responses with those delivered through the CDN. Do not expose an otherwise private origin merely to run this test.
  5. Invalidate affected entries after a fix. Existing cached pages or redirects may persist until they expire or are purged. Follow your provider's instructions and retest both language preferences, including repeated requests.

Use a controlled test URL or cache-purge procedure where possible. Adding a query parameter can change the cache key, so it may hide the problem rather than reproduce what ordinary visitors receive.

Common Mistakes

  • Comparing only screenshots. Check the initial URL, final URL, server response, and rendered page to locate where the language changed.
  • Following redirects without inspecting them. The language decision may occur in the first response, not the destination page.
  • Testing only with an existing session. A saved cookie or account setting can override browser preferences.
  • Assuming Vary fixes every cache issue. CDN cache-key rules, personalized responses, and old cached entries still need attention.
  • Assuming a language preference equals a location. Visitors can prefer any language regardless of where they connect from.

Best Practices

Make an explicit language choice easy to find and define how it interacts with browser preferences. Document the fallback for unsupported or missing preferences. Where practical, use distinct language URLs for content that should be directly linkable, and ensure a shared URL or redirect is cached according to the signals that affect its response.

After any change, test a fresh visitor, a visitor with a saved selection, and at least two different language headers. Repeat the checks through the CDN and inspect both redirects and final pages.

Conclusion

Different languages at the same URL may be intentional. Trace the language decision from request to rendered page, then verify that the cache distinguishes every signal that affects a shared response.

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.