In short
On a multilingual site, the URL is the contract: example.com/de/preise/ must return the German pricing page, with a 200 status code, to everyone. Neither the cookie, nor the browser language, nor the country of the IP address, nor the user agent should change the language or the main content of the response. The task is to test each template under these different conditions and remove any logic that makes the response vary. Once the task is done, the language is determined by the URL alone.
Why it matters
Google sums it up in its documentation on multilingual sites: it recommends separate URLs for each language rather than cookies or browser settings to adapt the content. Its crawler crawls without a persistent cookie, without an Accept-Language header and most often from American IP addresses. Any response that depends on one of these elements shows it a version your visitors do not necessarily see, and vice versa.
Several mechanisms break this contract, often without anyone intending it:
- internal rewrite: the URL stays
/tarifsbut the server serves the German file if a cookie asks for it; - content negotiation: the server picks the language from
Accept-Languageon an inner page; - silent fallback: a missing translation is replaced by the default language's text, with
lang="de"and a 200 status code; - special treatment for crawlers: the site serves a different version to crawler user agents, for example the English version to Googlebot;
- personalized fragments: menu, blocks or prices loaded based on the session and then cached.
The last case deserves attention: deliberately serving crawlers different content from what visitors get is cloaking, which Google's spam policies penalize. See eliminate deceptive cloaking (opens in a new tab). Generative engines, for their part, quote what they read: if their crawler received another language, the quoted answer no longer matches the page the user will open.
What it improves
- Indexing of each language The indexed page is the one the URL announces.
- hreflang and canonical The annotations connect stable pages, in the declared language.
- Citations in AI answers The quoted text matches the quoted URL. Indirect effect, never guaranteed.
- Caching One URL, one response, cacheable without variation.
- Sharing and support A link sent by a customer or a colleague opens the same way for everyone.
- Compliance No more risk of unintended cloaking.
How to check
Request the same URL under several conditions and compare four clues: response code, lang attribute, canonical and presence of a sentence from the main content. This script does the comparison:
#!/usr/bin/env bash
# Usage: bash test-url.sh https://example.com/de/preise/ "Monatliche Zahlung"
url="$1"
phrase="$2"
ua_browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0 Safari/537.36"
ua_google="Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
ua_gpt="Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.4; +https://openai.com/gptbot"
check() {
label="$1"
shift
body=$(mktemp)
code=$(curl -s -o "$body" -w '%{http_code}' "$@" "$url")
lang=$(grep -o -i '<html[^>]*lang="[^"]*"' "$body" | head -n 1 | sed -E 's/.*lang="([^"]*)".*/\1/')
canonical=$(grep -o -i '<link[^>]*rel="canonical"[^>]*>' "$body" | head -n 1 | grep -o 'href="[^"]*"')
count=$(grep -c -F "$phrase" "$body")
printf '%-22s %s lang=%-6s phrase=%-3s %s\n' "$label" "$code" "${lang:-missing}" "$count" "$canonical"
rm -f "$body"
}
check "browser" -A "$ua_browser"
check "no headers" -A ""
check "Accept-Language fr" -A "$ua_browser" -H "Accept-Language: fr-FR,fr;q=0.9"
check "Accept-Language ja" -A "$ua_browser" -H "Accept-Language: ja-JP,ja;q=0.9"
check "cookie lang=fr" -A "$ua_browser" -H "Cookie: lang=fr"
check "Googlebot" -A "$ua_google"
check "GPTBot" -A "$ua_gpt"
Replace lang in the cookie line with the actual name of your language cookie; crawler user agents change version, so take them from each vendor's documentation. Expected result: seven identical lines, with the same 200 code, the same language, the same canonical and the sentence found. A line that differs points to the condition that changes the response.
Good to know: a firewall may block requests that imitate Googlebot from an address that does not belong to Google: a 403 code on that line then comes from the bot protection, not from language handling. In that case, test from an allowed server, or use Search Console's URL Inspection tool.
Other checks:
- Search Console: URL Inspection tool, "Test live URL", on one URL per language. The crawled HTML must be in the URL's language. See check that each language is indexed independently (opens in a new tab).
- Countries: repeat the test from several countries, see check the CDN and language variants (opens in a new tab).
- Fragments: read one page per language in full in a private window: menu, footer, cookie banner and buttons must be in the URL's language.
How to implement
Before you start
The only data allowed to set the language of a response:
| Source | Allowed to set the language? | Acceptable use |
|---|---|---|
| URL prefix, subdomain or domain | Yes | Sole source of the language |
URL parameter (?lang=de) |
Yes if it is the chosen structure, provided it is consistent everywhere | Structure not recommended but valid |
| Cookie or session | No | Remember a choice for routing at the root |
Accept-Language header |
No | Non-blocking suggestion, routing at the root |
| Country of the IP address | No | Suggestion of a regional version |
| User agent | No | No use for the language |
Start by searching the code and configuration for reads of this data. Examine each occurrence: is it used to choose the language or the content of an inner page?
grep -rn -E "HTTP_ACCEPT_LANGUAGE|accept-language|HTTP_USER_AGENT|user-agent|CF-IPCountry|Viewer-Country|cookies\(\)|\\\$_COOKIE|navigator\.language" --include="*.php" --include="*.js" --include="*.ts" --include="*.tsx" --include="*.conf" --include=".htaccess" .
For a missing translation, decide on a single rule: a localized 404, or a redirect to the equivalent page that is available, never another language's text under the translated URL. See plan for missing translations (opens in a new tab).
Apache
Versions Apache 2.4.
Look for rules that read the cookie, the browser language or the user agent:
grep -rn -i -E "HTTP_COOKIE|HTTP:Accept-Language|HTTP_USER_AGENT" /etc/apache2/ /etc/httpd/ /var/www/ 2>/dev/null
Remove any rewrite or redirect that applies to content pages, for example:
# To remove: serves German under the same URL depending on the browser
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^(.*)$ /de/$1 [L]
Also check content negotiation directives (Options MultiViews, LanguagePriority, index.html.de files): mod_negotiation picks the language from Accept-Language. Turn it off on content folders with Options -MultiViews. Reload with sudo apachectl configtest && sudo systemctl reload apache2.
Nginx
Versions Nginx 1.18 and later.
sudo grep -rn -E "http_accept_language|http_user_agent|cookie_" /etc/nginx/
A map that chooses the document root or the backend based on one of these variables, for content URLs, should be removed. Keep at most a routing rule for the root, location = /. Reload with sudo nginx -t && sudo systemctl reload nginx.
Cloudflare
Versions Cloudflare dashboard, all plans, November 2026.
In the rules, Snippets and Workers, look for conditions on http.request.headers["accept-language"], http.cookie, http.user_agent or ip.src.country. A Worker that rewrites the HTML (for example with HTMLRewriter) based on one of them changes a URL's content: have it route to the language's URL rather than translate in place. Then purge the cache.
AWS
Versions AWS console, Amazon CloudFront, November 2026.
On CloudFront, check the functions attached to behaviors (CloudFront Functions and Lambda@Edge): none of them should change request.uri based on accept-language, a cookie, the user agent or cloudfront-viewer-country for a content page. Origin request policies that forward these headers to the application are a lead to follow: does the application use them for the language?
WordPress
Versions WordPress 6.4 and later; WPML 4 and 5, Polylang 3, TranslatePress, November 2026.
- Translation plugins: WPML, Polylang and TranslatePress set the language from the URL when the chosen format is directory, subdomain or domain. WPML's "parameter" format (
?lang=de) is still tied to the URL. Check that no browser language detection option applies beyond the home page. - Script-based or proxy-based translation: check with the script that the translated text is served to every user agent, crawlers included.
- Theme and custom plugins: search for
$_COOKIE,HTTP_ACCEPT_LANGUAGEandwp_is_mobileinwp-content, then examine the uses that change content. - Page cache: purge it, then run the test again, with an empty cache and then a warm one.
Shopify
Versions Shopify admin, Shopify Markets, all plans, November 2026.
Each published language has its URL prefix within a market. According to Shopify's documentation, when several markets share the same URL, search engines index only one version of it: give each market a domain, a subdomain or a subfolder. Turn off automatic redirection based on language and country (Online Store > Preferences, Automatic redirection section), and test translation and geolocation apps with the script.
Laravel
Versions Laravel 11 to 13; mcamara/laravel-localization 2.
The middleware that sets the language must read only the route parameter:
// app/Http/Middleware/SetLocale.php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\URL;
use Symfony\Component\HttpFoundation\Response;
class SetLocale
{
public function handle(Request $request, Closure $next): Response
{
$locale = $request->route('locale');
if (! in_array($locale, ['fr', 'de', 'en'], true)) {
abort(404);
}
App::setLocale($locale);
URL::defaults(['locale' => $locale]);
return $next($request);
}
}
Remove any App::setLocale(session('locale')) or reads of $request->getPreferredLanguage() outside the root's controller. With Laravel Localization (mcamara), set useAcceptLanguageHeader to false and do not use localeSessionRedirect or localeCookieRedirect as a source for the language.
Symfony
Versions Symfony 6.4, 7 and 8.
Declare {_locale} in the routes: Symfony then sets the request's language from the URL. The documentation example that stores the language in the session only applies it when the route has no _locale: if all your content routes have this parameter, the URL remains decisive. Check that no event listener reads Accept-Language for content pages.
Next.js
Versions Next.js 15 and 16 (App Router and Pages Router).
With both routers, check proxy.ts (middleware.ts before Next.js 16): it must not rewrite (NextResponse.rewrite) a content URL to another language.
App Router
The language comes from the [lang] segment. Look for calls to cookies() or headers() in content pages and layouts: if they are used to choose the language or the text, the page changes with the visitor and, on top of that, becomes dynamic.
Pages Router
The i18n configuration in next.config.js sets the language from the prefix or the domain. Turn off localeDetection if the root must not redirect based on Accept-Language or the NEXT_LOCALE cookie:
module.exports = {
i18n: {
locales: ['fr', 'de', 'en'],
defaultLocale: 'fr',
localeDetection: false,
},
}
Nuxt
Versions Nuxt 3 and 4, @nuxtjs/i18n module 9 and 10.
With @nuxtjs/i18n, the no_prefix strategy serves every language under the same URLs, chosen by cookie or by browser: switch to prefix_except_default or prefix. Keep detectBrowserLanguage.redirectOn set to 'root' and do not turn on alwaysRedirect.
Common mistakes
- Internal rewrite based on a cookie: the URL does not change, the language does.
MultiViewsenabled on Apache: negotiation picks anindex.html.defile based on the browser.- Fallback to the default language for a missing translation, with the
langand hreflang of the requested language. - English version served to crawlers "to make indexing easier": that is cloaking, and the other languages are no longer indexed.
- Testing only with your own browser: cookies and the system language hide the problem.
- Fragments cached without the language: the page is correct, the menu is not. See check per-language cache handling (opens in a new tab).
Frequently asked questions
Is serving a different language to Googlebot cloaking?
Yes, if the response served to the crawler deliberately differs from the one visitors get for the same URL, for example an English version reserved for Googlebot. Google classifies this practice among spam techniques. It also keeps the site's other languages from being indexed. The safe rule is simple: a URL returns the same language and the same main content to every client, crawlers included.
Should a page's language depend only on the URL?
Yes. The prefix, the subdomain or the domain must be enough to determine the response's language. The cookie and the browser language can be used to suggest another version or to route visitors at the site's root, never to change the content of an inner page. Crawlers crawl without a persistent cookie and without an Accept-Language header: they would see only one language.
Can prices or currency be adapted by country on the same URL?
It is possible for secondary elements, but Google may index only the variant its crawler sees, most often the American one. If prices, currency or availability really differ by country, create one URL per country, annotated with hreflang, with consistent structured data. The language of the text must never vary with the visitor's country.
How can you tell whether a URL serves different content depending on the visitor?
Request the same URL several times with curl, changing a single condition each time: no headers, various Accept-Language values, a language cookie, the user agent of Googlebot or of an AI crawler. Compare the response code, the lang attribute, the canonical and the presence of a sentence from the main content. Any difference points to the condition that changes the response.
Resources
- Google Search Central: Managing multi-regional and multilingual sitesdevelopers.google.com
- Google Search Central: How Google crawls locale-adaptive pagesdevelopers.google.com
- Google Search Central: Spam policies, cloakingdevelopers.google.com
- W3C: Guiding visitors to translated pagesw3.org
- Apache: Content negotiationhttpd.apache.org
- Symfony: Translations and the request localesymfony.com
- Shopify: International SEO for marketshelp.shopify.com
Updated on
Topic checklist (PDF)