Check 22.13 · International architecture

Check URL structure consistency

Audit the URL structure of each language (prefix, codes, trailing slash, case, translated segments) with a free script, Screaming Frog and a grid.

Priority
Critical
Difficulty
Intermediate
Estimated time
2 h to 1 day
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

On a multilingual site, every language must follow the same URL grammar: the language in the same place, written the same way, with the same conventions for trailing slashes, case and depth. This task is an audit: write down the rule, extract every URL of each language, find the deviations, then fix them with 301 redirects and in the code that builds the links. Deliverable: an approved grid of rules and a table of deviations down to zero.

Why it matters

Inconsistencies build up layer by layer: a language added by another team, a plugin replaced, a partial migration. You then find /fr/, /fr-fr/ and /FR/ side by side, German pages under /de/produits/, or the default language served both under / and under /fr/.

Each variant has a cost:

  • Duplicates: two URLs for the same content force Google to choose a canonical, not necessarily yours.
  • Fragile hreflang: annotations must target the exact URL, canonical and returning 200. A missing trailing slash or a capital letter is enough to produce a target that redirects.
  • Segmentation becomes impossible: Search Console, analytics and cache or CDN rules rely on prefixes. A /de/ that does not contain all the German pages skews every dashboard.
  • Broken links: a language switcher that replaces the prefix assumes a symmetrical structure.

Google does not rank one structure better than another. It does, however, recommend separate URLs per language and documents the requirement for canonical, absolute URLs in hreflang annotations: consistency is what makes these rules applicable at scale.

What it improves

  • Indexing Fewer duplicates and fewer canonicals chosen by Google against your wishes.
  • hreflang Exact targets, with no redirects.
  • Measurement A reliable language prefix for filtering Search Console, Bing Webmaster Tools and analytics.
  • Maintenance Cache, redirect and sitemap rules written once for every language.
  • Rankings No direct effect.

How to check

A first five-minute diagnosis, from the sitemaps:

for lang in fr de en; do curl -s "https://example.com/sitemap-${lang}.xml" | grep -o '<loc>[^<]*' | sed 's/<loc>//'; done > urls.txt
cut -d/ -f4 urls.txt | sort | uniq -c | sort -rn

Expected result: only your language codes (fr, de, en), plus possibly the root URLs if the default language has no prefix. An unexpected code (fr-fr, FR, deutsch) or a content segment in that position signals an inconsistency.

The steps below detail the full audit.

How to implement

Step 1 — Write the URL grammar

Set the rule down in a shared document before looking for deviations. A filled-in example:

Element Rule Compliant Non-compliant
Language position First path segment /de/preise/ /preise/de/, /preise/?lang=de
Code format Lowercase ISO 639-1; region in lowercase after a hyphen /de/, /fr-be/ /DE/, /fr_BE/, /german/
Default language Prefixed, like the others /fr/tarifs/ /tarifs/ and /fr/tarifs/ both returning 200
Trailing slash Always /de/preise/ /de/preise returning 200
Case Lowercase /de/preise/ /de/Preise/
Fixed segments Translated /de/produkte/ /de/produits/
Slugs Translated for pages and posts, reference kept for products /de/produkte/wanderschuh-x200/ /de/produkte/chaussure-rando-x200/
Depth Identical across versions of the same page /fr/blog/x/ and /de/blog/y/ /fr/blog/x/ and /de/y/
Host A single one, over HTTPS https://example.com www. and non-www. both returning 200

The choice between subdirectories, subdomains and country-code domains is covered in choose subdirectories, subdomains or country-code domains (opens in a new tab), slugs in translate slugs if relevant (opens in a new tab), and the default language in define the default version (opens in a new tab). This step only records those decisions in a form that can be checked.

Step 2 — Extract every URL

Cross-reference three sources, since each one has blind spots:

  • Sitemaps: the URLs you declare (command from the “How to check” section).
  • Crawl: the URLs actually linked, including those missing from the sitemap.
  • Search Console: the URLs Google knows about, from the Pages report or the Performance report export.

Gather them in urls.txt, one per line.

Step 3 — Check the rules automatically

This Python script, with no dependencies, applies the grammar from step 1 and produces a CSV file of deviations. Adapt the constants to your site:

# audit_url_structure.py
import csv
import sys
from collections import Counter
from urllib.parse import urlparse

HOST = 'example.com'
LANGUAGES = {'fr', 'de', 'en'}
TRAILING_SLASH = True
SECTIONS = {
    'fr': {'produits', 'blog', 'aide'},
    'de': {'produkte', 'blog', 'hilfe'},
    'en': {'products', 'blog', 'help'},
}

writer = csv.writer(sys.stdout)
writer.writerow(['url', 'problem'])
inventory = Counter()

for line in sys.stdin:
    url = line.strip()
    if not url:
        continue
    parts = urlparse(url)
    segments = [segment for segment in parts.path.split('/') if segment]
    lang = segments[0] if segments else ''
    problems = []
    if parts.netloc != HOST:
        problems.append(f'host {parts.netloc}')
    if parts.query:
        problems.append('parameters in the URL')
    if parts.path != parts.path.lower():
        problems.append('uppercase letters')
    if '_' in parts.path or '//' in parts.path:
        problems.append('underscore or double slash')
    if TRAILING_SLASH and not parts.path.endswith('/'):
        problems.append('missing trailing slash')
    if lang not in LANGUAGES:
        problems.append(f'missing or unknown language prefix: {lang or "root"}')
    elif len(segments) > 1:
        section = segments[1]
        if section in LANGUAGES:
            problems.append('double language prefix')
        foreign = [other for other in LANGUAGES - {lang} if section in SECTIONS[other] - SECTIONS[lang]]
        if foreign:
            problems.append(f'segment “{section}” belongs to language {foreign[0]}')
        inventory[(lang, section, len(segments))] += 1
    for problem in problems:
        writer.writerow([url, problem])

for (lang, section, depth), count in sorted(inventory.items()):
    print(f'{lang};{section};{depth};{count}', file=sys.stderr)
python3 audit_url_structure.py < urls.txt > ecarts.csv 2> inventaire.csv

ecarts.csv lists each non-compliant URL and the rule it breaks. If your default language is deliberately served at the root without a prefix, filter out those lines or adapt the rule.

Step 4 — Compare the languages with each other

inventaire.csv gives, for each language, the number of URLs per section and per depth. Import it into Google Sheets and build the comparison grid:

Section (fr) Depth fr de en de coverage en coverage
produits / produkte / products 4 1,240 1,180 1,236 95% 99.7%
blog 3 310 42 288 14% 93%
aide / hilfe / help 3 85 85 0 100% 0%

Coverage formula, with the counts in columns C to E: =IFERROR(D2/C2, 0), formatted as a percentage. How to read it:

  • Expected low coverage (German blog at 14%): editorial strategy, nothing to fix on the structure side.
  • A section at 0% although it is in the menu: the section may be served under another segment, or under the source language's segment. Look for it in ecarts.csv.
  • The same section at two depths in one language: an incomplete migration or a different routing rule.

Then check the pairs of equivalents: every URL annotated in hreflang must follow the same grammar as its source page. See check hreflang reciprocity (opens in a new tab).

Step 5 — Fix and lock down

For each deviation, three actions:

  1. Fix the source: the template, menu, switcher or sitemap generator that produces the non-compliant URL.
  2. 301-redirect the old form to the compliant form, without a redirect chain.
  3. Update internal links so that they target the compliant form directly.

Examples of redirects from an old language code format (/fr_FR/… or /fr-fr/… to /fr/…). On Apache, in the .htaccess file:

RewriteEngine On
RewriteRule ^(fr|de|en)[-_][a-zA-Z]{2}/(.*)$ /$1/$2 [R=301,L]

On Nginx, in the server block:

location ~* "^/(fr|de|en)[-_][a-z]{2}/(.*)$" {
    return 301 /$1/$2$is_args$args;
}

Only use these rules if you have no legitimate regional variants (/fr-be/). For the trailing slash and case, first set the behavior of the framework or CMS, which generates the links, then add a catch-all redirect.

To lock it down, add the step 3 script to your continuous integration, run against the generated sitemap, and make the deployment fail if ecarts.csv contains any lines. See integrate multilingual tests into CI/CD (opens in a new tab).

With Screaming Frog

  • URL tab: the filters on uppercase, underscores, parameters and multiple slashes isolate formatting deviations.
  • Segments: create one segment per language based on the prefix; the reports can then be read language by language.
  • Hreflang tab: enable the storing and crawling of hreflang in Configuration > Spider > Crawl. The filters flag targets that are non-200, non-canonical or missing a return link, often caused by a URL variant.
  • Structure visualizations (Visualisations menu): the directory tree view shows at a glance a language filed under a foreign segment.

The free version caps the number of URLs crawled: enough for a medium-sized site or for a sample per language.

With Google Search Console

Add a URL-prefix property for each language (https://example.com/de/) in addition to the Domain property. In each one, the Pages report shows the language's indexed and excluded URLs; a URL outside the prefix appearing among the examples, or “Duplicate, Google chose different canonical than user”, signals a variant to redirect. The URL Inspection tool gives the canonical selected by Google for a given URL.

Common mistakes

  • Two code formats coexisting (/fr/ and /fr-fr/) after a regional variant is added.
  • Default language served under / and /fr/ without a redirect.
  • Fixed segments left untranslated in a single language (/de/produits/), often a section added after the initial translation.
  • Inconsistent trailing slash between the sitemap, the hreflang annotations and the internal links.
  • Fixing links without redirecting the old URLs, which are already indexed and linked from outside.
  • Redirecting without fixing the source: the template keeps producing the faulty URL, and every link goes through a redirect.
  • Changing the structure without a migration plan: an overhaul of the URL grammar is a migration. See create a comprehensive redirect map (opens in a new tab).

Frequently asked questions

Must every language have exactly the same URL structure?

The same grammar, yes: the language in the same place, the same code format, the same conventions for trailing slashes and case, the same depth for a page and its translations. The content of the segments may differ, since slugs and section names are translated. Google does not favor any structure, but a shared grammar makes hreflang, redirects and segmentation reliable.

Should the language code be lowercase in the URL?

It is a convention, not a Google rule, but it avoids duplicates: on most servers, /FR/ and /fr/ are two distinct URLs. Choose one form, usually the lowercase ISO 639-1 code with any region after a hyphen, apply it everywhere, in links, the sitemap and hreflang, and 301-redirect the other variants to that form.

How do you find a language's pages filed under the wrong prefix?

Extract every URL from the sitemaps, a crawl and Search Console, then compare the first segment after the language with the list of that language's sections. A segment that belongs to another language, such as /de/produits/, or a section missing from a language although it appears in the menu, reveals the problem. A script or Screaming Frog segments run this check in a few minutes.

Do you need to rebuild the whole structure if it is inconsistent?

Not necessarily. First fix the deviations that create duplicates or hreflang targets that redirect, with 301 redirects and template fixes. A complete overhaul of the URL grammar is a migration, with its risk of temporary traffic loss: only undertake it if the inconsistency permanently gets in the way of managing the site, and with a comprehensive redirect map.

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