Check 22.04 · International architecture

Choose subdirectories, subdomains or country-code domains

Compare subdirectories, subdomains and country-code domains, choose the right international structure and set it up on your server, CMS or framework.

Priority
Critical
Difficulty
Advanced
Estimated time
1 to 3 days
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

An international site organizes its versions in one of three ways: subdirectories (example.com/fr/), subdomains (fr.example.com) or country-code domains (example.fr). Google advises against URL parameters (example.com/?lang=fr). The choice commits the site for years: it determines hosting, measurement, link building and the cost of each new version. Once the task is done, the structure is decided, documented and configured the same way for every version.

Why it matters

Google documents all three structures without imposing one. Each has its advantages and constraints:

Structure Example Documented advantages Documented drawbacks
Country-code domain (ccTLD) example.de Clear geotargeting, server location irrelevant, sites easy to separate Expensive, sometimes unavailable, more infrastructure, strict registration rules in some countries, one country per domain
Subdomain on a generic domain de.example.com Easy to set up, servers possible in several countries, sites easy to separate Visitors cannot always tell whether de means a language or a country
Subdirectory on a generic domain example.com/de/ Easy to set up, low maintenance on a single host Targeting less obvious to visitors, a single server location, harder to separate
URL parameter example.com/?loc=de None Not recommended: hard to segment, unclear targeting

Google does not name a winner: its documentation lists these advantages and drawbacks without ranking the structures, and its representatives have said publicly many times that Search treats subdomains and subdirectories in a comparable way. No structure is penalized.

The difference in strength comes from the number of sites you have to keep alive. In a subdirectory, a new language is born inside a site that already has links, a crawl history and internal linking. On a country-code domain, it starts from scratch and has to earn its own authority, in exchange for the strongest geotargeting signal Google documents. Practitioners often report traffic gains after moving from subdomains to subdirectories: these are field reports, not controlled studies, and the migration almost always comes with other changes.

Changing structure later is a full migration: redirects for every URL, new measurement properties, a risk of temporary losses.

What it improves

  • Cost of launching a new version Low with subdirectories, high with one domain per country.
  • Consolidation of links and authority A single domain pools the efforts. Commonly observed effect, not documented by Google.
  • Geotargeting Maximal with a ccTLD, explicit with hreflang in the other cases.
  • Measurement Subdirectories and subdomains are easy to segment in Search Console and Analytics.
  • Crawling Subdirectories on a single host, centralized crawl management.
  • Rankings No structure is favored in itself.

How to check

List the published versions and their URL form:

curl -s https://example.com/ | grep -o -i -E 'hreflang="[^"]*" href="[^"]*"'

Expected result: every version follows the same pattern, for example https://example.com/fr/, https://example.com/de/, https://example.com/en/. A mix (/fr/, de.example.com, example.com/?lang=en) indicates a structure that was never decided.

Then check that no language depends on a parameter or a cookie: each version URL must return 200 in the right language without a cookie, without an Accept-Language header and without a parameter.

How to implement

Compare the three structures

Criterion Subdirectory (example.com/fr/) Subdomain (fr.example.com) Country-code domain (example.fr)
Authority of the main domain Shared from the start: links, history and internal linking serve every version Comparable to a subdirectory according to Google; often experienced by practitioners as a separate site that needs to be linked and supported No automatic transfer: each domain builds its own links
Geographic signal Weak in itself: hreflang with a country code, currency, address, local links Same as a subdirectory The strongest documented by Google, one country per domain; .tv, .me, .co, .io count as generic
Cost and maintenance One domain, one certificate, one DNS zone, one host One DNS record per subdomain, a wildcard certificate *.example.com, sometimes several hosts Per domain: purchase, renewal, registry rules, DNS zone, certificate, CDN configuration
Search Console One Domain property, plus one URL-prefix property per folder The Domain property covers every subdomain; one URL-prefix property per subdomain One property per domain, with no combined total
Analytics Segmentation by path Shared cookie (automatic in GA4), declaring the domains is recommended Cross-domain measurement required
Crawling and server One host, one robots.txt, one server or CDN One robots.txt per subdomain; servers possible in several countries Robots.txt, sitemap and statistics per domain; server location irrelevant
The right choice when Most sites: one team, one platform, versions added gradually An imposed infrastructure: another platform, hosting in a given country Separate legal entities, a local extension that inspires trust, ccTLDs that are already strong, a budget for each domain

The "Geographic signal" and "Crawling and server" rows reflect Google's documentation. The "Authority" row comes from industry experience: Google publishes no rule on how authority passes between hosts. Measurement details for each structure are in segment traffic by language and country URL (opens in a new tab).

Choose: subdirectories by default

Start from subdirectories: they concentrate links, content and signals on a single host, and they are the easiest to run and to measure. Only move away from them if one row of this grid is true today, not hypothetically:

Question If yes
Are the versions languages with no difference in the offer by country? Language subdirectories (/fr/, /de/)
Are you targeting a few countries with a shared site and few resources per country? Language-country subdirectories (/fr-ch/, /de-ch/)
Is each country a legal entity, with its own team, catalog or platform? Country-code domains, or subdomains if the ccTLDs are unavailable
Must a version run on another platform or be hosted in a specific country? Subdomain, or country-code domain if the market justifies it
In this market, does the local extension (.fr, .de) affect trust and conversion? Country-code domain, if the budget allows
Do you have the budget for local links and content on each domain? If not, stay with subdirectories: an unsupported country-code domain stays weak for a long time
Do you already own strong ccTLDs, with history and links? Keep them rather than migrate, unless there is a strong reason

Rules common to every structure:

Apache

Versions Apache 2.4.

Subdirectories: nothing to configure at server level, the application handles the prefix. Subdomains or country-code domains: one virtual host per name, pointing to the same application or to separate document roots.

<VirtualHost *:443>
    ServerName example.com
    ServerAlias de.example.com fr.example.com
    DocumentRoot /var/www/example/public
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>

<VirtualHost *:443>
    ServerName example.de
    ServerAlias www.example.de
    DocumentRoot /var/www/example/public
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/example.de/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.de/privkey.pem
</VirtualHost>

The application then reads the host name to choose the language. Test, then reload: sudo apachectl configtest && sudo systemctl reload apache2.

Nginx

Versions Nginx 1.25.1 and later; for an earlier version, see the note below the example.

Same logic, one server block per host name, in /etc/nginx/sites-available/example.conf:

server {
    listen 443 ssl;
    http2 on;
    server_name example.com de.example.com fr.example.com;
    root /var/www/example/public;
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    index index.php index.html;
}

server {
    listen 443 ssl;
    http2 on;
    server_name example.de www.example.de;
    root /var/www/example/public;
    ssl_certificate /etc/letsencrypt/live/example.de/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.de/privkey.pem;
    index index.php index.html;
}

On a version of Nginx earlier than 1.25.1, replace http2 on; with listen 443 ssl http2;. Reload with sudo nginx -t && sudo systemctl reload nginx. For subdomains, a wildcard certificate (*.example.com) saves you from creating one per language.

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

  • Subdirectories: nothing to add, the existing zone covers everything.
  • Subdomains: in DNS > Records, add a CNAME record de pointing to example.com, proxied (orange cloud). The Universal SSL certificate covers first-level subdomains.
  • Country-code domains: each ccTLD is a separate zone to add to the account, with its own cache, security and redirect rules. Duplicate the settings or manage them through the API or Terraform to avoid discrepancies.

Check that cache rules do not vary a given URL by cookie or by the Accept-Language header: with the language in the URL, this is unnecessary.

Vercel

Versions Vercel dashboard, all plans, November 2026.

In the project, under Settings > Domains, add each subdomain or country-code domain. Language routing is configured in the framework (see Next.js). Vercel issues certificates automatically.

Netlify

Versions Netlify UI, all plans, November 2026.

Domain management > Add a domain for each subdomain or country-code domain. Subdirectories are handled in the site generator or with _redirects rewrite rules.

WordPress

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

The choice is made in the multilingual plugin:

  • WPML: WPML > Settings > URLs and SEO, Language URL format section. Three options: directories (/fr/), different domains or subdomains, or a parameter (?lang=fr, to avoid). The "Use directory for default language" option also puts the main language in a subdirectory. For directories, WPML manages its own rewrite rules: do not create real folders.
  • Polylang: Languages > Settings, URL modifications module. Choose "The language is set from the directory name in pretty permalinks" for subdirectories, or the subdomain or multiple domains option; all of them must point to the same WordPress installation.
  • TranslatePress: subdirectories (/fr/), with an option to also put the default language in a subdirectory.
  • Weglot: subdirectories or subdomains depending on the integration chosen.
  • WordPress Multisite: one site per language or per country, in subdirectories or subdomains, often connected by a translation plugin. Useful when teams and catalogs differ widely.

Shopify

Versions Shopify admin, all plans, November 2026.

In the Shopify admin, go to Markets, click the market, then Languages and domains and Manage domains. The options offered are: primary market configuration, subfolders, a separate domain or subdomain, or multiple domains. Subfolders combine language and region (/fr-ca, /en-eu) and are recommended by Shopify for a first rollout. Shopify automatically creates hreflang annotations for each international domain or subfolder.

Warning: Shopify states that the content of markets served on a shared domain, without their own URL, is not indexed by search engines. Give a distinct URL to every market you want to appear in search results.

Webflow

Versions Webflow Localization, November 2026.

Webflow Localization publishes each secondary language in a subdirectory of the domain (/fr). Country-code domains are not part of the standard setup: check your plan in Webflow's documentation.

Wix

Versions Wix Multilingual, November 2026.

Wix Multilingual serves each language under a distinct URL, in a subdirectory by default. The structure options available depend on your site: check them in the Wix Multilingual settings.

Laravel

Versions Laravel 10 to 13. The routes are the same everywhere; only the middleware registration changes from Laravel 11 onward.

Subdirectories: a route prefix.

// routes/web.php
use App\Http\Controllers\PagesController;
use Illuminate\Support\Facades\Route;

Route::prefix('{locale}')
    ->where(['locale' => 'fr|de|en'])
    ->middleware('setLocale')
    ->group(function () {
        Route::get('/', [PagesController::class, 'home'])->name('home');
        Route::get('/tarifs', [PagesController::class, 'pricing'])->name('pricing');
    });

Subdomains or country-code domains: one group per domain.

Route::domain('{locale}.example.com')
    ->where(['locale' => 'fr|de|en'])
    ->middleware('setLocale')
    ->group(function () {
        Route::get('/', [PagesController::class, 'home']);
    });

Route::domain('example.de')
    ->middleware('setLocale:de')
    ->group(function () {
        Route::get('/', [PagesController::class, 'home']);
    });

The setLocale middleware (yours to write) calls App::setLocale() with the route parameter or the fixed value. The Laravel Localization package (mcamara), version 2.x for Laravel 11 to 13, automates the prefix and translated routes. You still have to declare the setLocale alias, and that is where the versions diverge.

Laravel 11 to 13

Since Laravel 11, app/Http/Kernel.php no longer exists: the alias is declared in bootstrap/app.php.

use App\Http\Middleware\SetLocale;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    // ->withRouting(...)
    ->withMiddleware(function (Middleware $middleware): void {
        $middleware->alias([
            'setLocale' => SetLocale::class,
        ]);
    })
    // ->withExceptions(...)
    ->create();

An application upgraded from Laravel 10 without changing its structure can keep its Kernel.php: in that case, follow the next tab.

Laravel 10

Add the alias in app/Http/Kernel.php:

protected $middlewareAliases = [
    // … existing aliases
    'setLocale' => \App\Http\Middleware\SetLocale::class,
];

Next.js

Versions Next.js 15 and 16.

App Router

Place the pages under an app/[lang]/ dynamic segment: each language gets its own subdirectory (/fr/produits). For one domain per language, route on the Host header in proxy.ts (on Next.js 15: the middleware.ts file and the exported middleware function).

Pages Router

The i18n configuration in next.config.js offers both strategies:

// next.config.js
module.exports = {
  i18n: {
    locales: ['en', 'fr', 'de'],
    defaultLocale: 'en',
    localeDetection: false,
    domains: [
      { domain: 'example.com', defaultLocale: 'en' },
      { domain: 'example.fr', defaultLocale: 'fr' },
      { domain: 'example.de', defaultLocale: 'de' },
    ],
  },
};

Without the domains key, Next.js uses subdirectories (/fr/blog), with the default language left unprefixed. localeDetection: false disables automatic redirection based on the browser language.

Common mistakes

  • Choosing country-code domains for prestige without the teams or the budget to keep each domain alive.
  • Avoiding subdomains for fear of a penalty: there is none. The real cost is the scattering of links and measurement.
  • Mixing structures: /fr/, de.example.com and ?lang=en on the same site.
  • A URL parameter for the language: a structure Google does not recommend, hard to measure and segment.
  • Subdomains for languages that share everything: more configuration, no benefit.
  • A ccTLD for a language: example.de for all German speakers targets Germany, not Austria or Switzerland.
  • Changing structure without a migration plan: see create a comprehensive redirect map (opens in a new tab).
  • Forgetting the Search Console properties for each version: you then cannot read performance by market.

Frequently asked questions

Subdirectories or subdomains: which is better for SEO?

Google favors neither structure: its documentation lists their advantages without ranking them, and its representatives say they treat them in a comparable way. Subdirectories remain the safest default choice, because they concentrate links, content and signals on a single host and are simpler to measure. The gains reported after moving from subdomains to subdirectories are field reports, not proof. Subdomains are justified when a separate infrastructure is imposed.

Does a country-code domain such as .de or .fr help you rank in that country?

According to Google, a country-code domain is a strong geotargeting signal: it clearly indicates the targeted country. On the other hand, it restricts the site to that country, costs more to maintain and forces you to build each domain's authority separately. Some extensions such as .tv, .me or .co are treated as generic and target no country. A ccTLD does not guarantee better rankings.

Can you use a ?lang=fr parameter for languages?

Google advises against it: URL parameters make segmentation difficult and targeting unclear for visitors. If your site works this way, switch to subdirectories such as /fr/ and redirect each old parameter URL to its new address with a 301 redirect. In WordPress, WPML and Polylang let you change this format from their URL settings.

Should the default language go in a subdirectory?

Both choices work. Keeping the default language at the root preserves existing URLs when you add languages to an established site. Putting it in its own subdirectory, with a root that acts as a selector, makes every version symmetrical and simplifies the code. What matters is that the root does not force a redirect based on IP address or browser language.

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