Check 22.14 · International architecture

Define the default version

Choose the default language, what the root serves and the x-default target, then configure Apache, Nginx, Cloudflare, WordPress, Shopify or Next.js.

Priority
Critical
Difficulty
Intermediate
Estimated time
1 to 3 h
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

“Default version” covers three related decisions: the site's reference language (the language of the source content and the fallback for interface strings), what the root example.com/ serves, and the page designated by the hreflang="x-default" annotation for visitors whose language is not offered. This task consists of making these three decisions together, writing them down, then configuring them. Once it is done, the root responds predictably, the default language exists under a single URL only, and each group of equivalent pages carries a consistent x-default.

Why it matters

Google defines x-default as the value used when no other language or region matches the user's browser settings. It recommends it for designating the fallback page, in particular a language or country selection page, or a homepage that redirects automatically, and states that it was designed for language selector pages. Without x-default, Google chooses for itself which version to show a user whose language is not covered: a Polish user may land on the German version rather than the English one.

The root is the other sensitive point. If it serves the default language and that language also exists under /fr/, you have two URLs for the same page. If it redirects based on IP or browser language, Googlebot, which usually crawls from the United States and without an Accept-Language header, only sees one version. Both cases are covered in avoid forced IP-based redirects (opens in a new tab) and avoid forced redirects based on browser language (opens in a new tab).

Finally, the CMS's default language determines what is displayed when a translation is missing. A decision taken by default, at installation, often produces fallback pages that then have to be tracked down.

What it improves

  • The right version shown to users whose language is not offered, thanks to x-default.
  • Indexing No duplicate between / and /fr/.
  • Crawling A root that returns 200, readable by every crawler, including those of generative engines.
  • Technical consistency Sitemaps, hreflang, canonicals and the switcher built on the same rule.
  • Rankings No direct effect.

How to check

1. The root:

curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' https://example.com/
curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' -H "Accept-Language: de-DE,de;q=0.9" https://example.com/

Expected result: 200 in both cases (selection page or default language), or a 302 to a language if you chose to route the root. A 301, or a response that varies by language without x-default, needs fixing.

2. The default language under a single URL: if the default language has no prefix, https://example.com/fr/ must 301-redirect to https://example.com/ or return 404; if it has a prefix, the root must not serve the same page with a 200.

3. The x-default:

curl -s https://example.com/fr/tarifs/ | grep -o -E '<link[^>]*hreflang="x-default"[^>]*>'

One line expected, identical on every version in the group (/fr/tarifs/, /de/preise/, /en/pricing/). Also check the sitemaps if you declare hreflang there.

4. Search Console: inspecting the root shows whether Googlebot receives a page or a redirect.

How to implement

Before you start

Make the three decisions with this table:

Site profile Language at the root x-default target
Existing single-language site adding languages Original language, without a prefix, to keep the indexed URLs The original version
Multilingual from the start, audiences of comparable size None: all languages prefixed, root as a selection page The selection page
International site with a lingua franca English, prefixed or not The English version
Regional variants of the same language (fr-fr, fr-be, fr-ch) Country selection page The selection page

Common rules:

  • One URL per page: the default language is either at the root or under its prefix, never both.
  • No 301 on the root to a language: use 200, or 302 if you route the visitor.
  • x-default on every version in a group, pointing to the same URL. For deep pages with no equivalent selection page, designate the default language's version.
  • The selection page is a real page: <a href> links to each language, complete hreflang annotations, short text in each language with the lang attribute.

Example with the root as a selection page:

<link rel="alternate" hreflang="fr" href="https://example.com/fr/">
<link rel="alternate" hreflang="de" href="https://example.com/de/">
<link rel="alternate" hreflang="en" href="https://example.com/en/">
<link rel="alternate" hreflang="x-default" href="https://example.com/">

These four lines appear identically on /, /fr/, /de/ and /en/. In a sitemap, the same declaration is written:

<url>
  <loc>https://example.com/fr/tarifs/</loc>
  <xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs/"/>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise/"/>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/pricing/"/>
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/fr/tarifs/"/>
</url>

Choose one declaration method (HTML, sitemap or HTTP header) rather than combining them: Google treats them as equivalent, and each additional method is a source of inconsistency.

Apache

Versions Apache 2.4.

If the default language is at the root without a prefix, redirect the old prefix. In the .htaccess file:

RewriteEngine On
RewriteRule ^fr/(.*)$ /$1 [R=301,L]

If every language is prefixed and the root is a static selection page, no rule is needed: index.html at the root returns 200. Reload with sudo apachectl configtest && sudo systemctl reload apache2 if you change the virtual host.

Nginx

Versions Nginx 1.24 and later.

In the server block:

location ^~ /fr/ {
    rewrite ^/fr/(.*)$ /$1 permanent;
}

For a static selection page at the root:

location = / {
    try_files /index.html =404;
}
sudo nginx -t && sudo systemctl reload nginx

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

To remove the default language's prefix without touching the server, create a redirect rule: Rules > Redirect Rules from the rules overview.

  • Wildcard pattern: request URL https://example.com/fr/*
  • Target URL: https://example.com/${1}
  • Status code: 301, query string preserved.

If you route the root based on browser language, only use 302s and exclude / from the HTML cache, as described in avoid forced redirects based on browser language (opens in a new tab).

WordPress

Versions WordPress 6.8 to 7.1; Polylang 3.x, WPML 5.x, TranslatePress 3.x.

  • Polylang: the default language is chosen in Languages > Languages (star icon in the list). In Languages > Settings, the URL modifications module lets you hide the default language's code. Polylang only adds an x-default on the automatically redirected homepage; to declare one on every page, use the pll_rel_hreflang_attributes filter in a child theme's functions.php or a custom plugin:
add_filter('pll_rel_hreflang_attributes', function (array $hreflangs): array {
    if (! isset($hreflangs['fr'])) {
        return $hreflangs;
    }

    $hreflangs['x-default'] = $hreflangs['fr'];

    return $hreflangs;
});

The array keys are the hreflang values configured for your languages (fr, or fr-FR depending on your settings): view a page's source code to find them.

  • WPML: the default language is set in WPML > Languages, in the site languages section. WPML assigns the x-default to the default language; to point it elsewhere, the wpml_hreflangs filter lets you modify the array of annotations. If a page does not exist in the default language, it has no x-default.
  • TranslatePress: the default language is chosen in Settings > TranslatePress, General tab; an option also places this language in a subdirectory.

Changing the default language on a live site changes thousands of URLs: treat it as a migration.

Shopify

Versions Shopify admin, all plans, November 2026.

The default language is the store's primary language, in Settings > Languages. It is served without a prefix; the other languages get a subdirectory. Shopify generates the hreflang annotations in content_for_header: check the presence and target of the x-default in the source code, because the result depends on how markets and domains are configured. Changing the default language deletes the existing translations for the language you choose: export them first.

Laravel

Versions Laravel 10 to 13.

The default language is locale in config/app.php (the APP_LOCALE variable since Laravel 11; in Laravel 10, the value is written directly in the file), and fallback_locale serves as the fallback for interface strings. With the Laravel Localization package (mcamara, version 2.x for Laravel 11 to 13), hideDefaultLocaleInURL in config/laravellocalization.php decides whether the default language has a prefix. Add the x-default in the template, from the page's array of equivalent URLs:

{{-- resources/views/layouts/app.blade.php, in the <head> --}}
@foreach($alternates ?? [] as $locale => $url)
    <link rel="alternate" hreflang="{{ $locale }}" href="{{ $url }}">
@endforeach

@isset($alternates[config('app.locale')])
    <link rel="alternate" hreflang="x-default" href="{{ $alternates[config('app.locale')] }}">
@endisset

Next.js

Versions Next.js 15 and 16.

App Router

Declare x-default in alternates.languages, which produces one tag per key:

// app/[lang]/tarifs/page.tsx
import type { Metadata } from 'next';

export const metadata: Metadata = {
  alternates: {
    canonical: 'https://example.com/fr/tarifs/',
    languages: {
      fr: 'https://example.com/fr/tarifs/',
      de: 'https://example.com/de/preise/',
      en: 'https://example.com/en/pricing/',
      'x-default': 'https://example.com/fr/tarifs/',
    },
  },
};

Pages Router

defaultLocale in the i18n configuration of next.config.js designates the language served without a prefix; add the x-default in the Head component.

Nuxt

Versions Nuxt 3.x and 4, @nuxtjs/i18n module 9 and 10.

With @nuxtjs/i18n, defaultLocale designates the default language and strategy its prefix: prefix_except_default serves it without a prefix, prefix prefixes every language. The hreflang tags are produced by useLocaleHead(); check the presence and target of the x-default in the generated HTML, as they depend on the module version and its configuration.

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/i18n'],
  i18n: {
    baseUrl: 'https://example.com',
    defaultLocale: 'fr',
    strategy: 'prefix',
    locales: [
      { code: 'fr', language: 'fr', name: 'Français' },
      { code: 'de', language: 'de', name: 'Deutsch' },
      { code: 'en', language: 'en', name: 'English' },
    ],
  },
});

Astro

Versions Astro 5 to 7. Only the default value of redirectToDefaultLocale changes from Astro 6 onward.

In astro.config.mjs, i18n.defaultLocale designates the default language, and routing.prefixDefaultLocale decides whether it has a prefix (false by default). With prefixDefaultLocale: true, the root remains a separate page, src/pages/index.astro, which you can turn into a selection page; the redirectToDefaultLocale: true option redirects it to the default language. Since Astro 6, this option defaults to false and is only accepted with prefixDefaultLocale: true; in Astro 5, it defaulted to true, so the root was redirected unless you disabled it. Check the status code of this redirect with curl, then add the hreflang annotations and the x-default in the template.

Common mistakes

  • Default language served under both / and /fr/ with a 200.
  • A 301 redirect from the root to a language, cached by browsers.
  • A different x-default from one version to another within the same group of pages.
  • x-default on the root only, when every group of pages deserves one.
  • A selection page without HTML links, with a mere JavaScript drop-down menu.
  • A default language chosen at installation out of habit, when most of the traffic comes from another market.
  • Changing the default language without a redirect map.

Frequently asked questions

What is the x-default value in hreflang?

x-default is a reserved value of the hreflang attribute that designates the page to show when none of the declared languages or regions matches the user's browser settings. Google recommends it for designating the fallback page, in particular a language or country selection page. It is declared on every version in a group of pages, with the same target.

Should the default language be at the root of the site?

Both choices work. Keeping the original language at the root, without a prefix, preserves the URLs already indexed when an existing site opens up to other languages. Prefixing every language and making the root a selection page makes the versions symmetrical. What matters is that a page exists under one URL only: if the default language is at the root, /fr/ must 301-redirect.

Which page should the x-default point to?

To the page most useful to a visitor whose language is not offered. For the root, that is often a language selection page. For deep pages, designate the version in the language most widely understood by your audience, often English, or failing that the site's default language. Keep the same target on every version within the same group of pages.

Can the homepage redirect to the default language?

Yes, with a temporary 302 redirect, not a 301 that browsers cache. A fixed redirect to the default language poses no risk for crawling. A redirect that depends on browser language or IP must be limited to the root, along with a Vary header and an x-default pointing to the root. Serving a page directly with a 200 remains the simplest option.

Updated on

Topic checklist (PDF)

And now?

In the “International architecture” topic

  1. Define target languages
  2. Define target countries
  3. Distinguish language from geotargeting
  4. Choose subdirectories, subdomains or country-code domains
  5. Plan a separate URL for each language version
  6. Translate slugs if relevant
  7. Avoid handling language only through cookies/JS
  8. Avoid forced IP-based redirects
  9. Avoid forced redirects based on browser language
  10. Provide a crawlable language switcher
  11. Link to the equivalent page rather than the homepage
  12. Plan for missing translations
  13. Check URL structure consistency
  14. Define the default version
  15. Avoid mixed-language pages with partial translations