Hreflang Guide for Multilingual and Multi-Country Websites (With Examples)

Hreflang tells search engines which language or country version of a page to show. Here is how it works, with clear examples, platform tips and the errors that break it most often.

If your website has versions in multiple languages or for multiple countries, hreflang helps search engines show the right version to the right users. Without it, a German visitor may land on your English page, or your Belgian and Dutch pages may compete with each other.

This guide explains how hreflang works, with examples you can copy.

What hreflang does

Hreflang is an annotation that says: “This page has equivalent versions in these languages or regions, and here are their URLs.”

It helps search engines:

  • Show the right language or country version in search results
  • Understand that similar pages for different countries are alternatives, not duplicates

It does not redirect users, and it is not a ranking boost on its own.

Language and region codes

The value is a language code (ISO 639-1), optionally followed by a region code (ISO 3166-1 Alpha 2):

Value Meaning
en English, any region
en-GB English for the United Kingdom
nl Dutch, any region
nl-BE Dutch for Belgium
de-AT German for Austria
tr Turkish
x-default Fallback for users who match no other version

Common mistakes: en-UK (wrong, it is en-GB), a region code on its own like be (that is the language code for Belarusian), or using a country code as a language code.

Example: language versions

A site in English, Dutch, German and Turkish:

<link rel="alternate" hreflang="en" href="https://www.example.com/en/services/" />
<link rel="alternate" hreflang="nl" href="https://www.example.com/nl/diensten/" />
<link rel="alternate" hreflang="de" href="https://www.example.com/de/leistungen/" />
<link rel="alternate" hreflang="tr" href="https://www.example.com/tr/hizmetler/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/en/services/" />

This exact block goes on every one of these four pages, including a reference to the page itself.

Example: same language, different countries

A shop selling in the Netherlands and Belgium with different prices and shipping:

<link rel="alternate" hreflang="nl-NL" href="https://www.example.com/nl-nl/hardloopschoenen/" />
<link rel="alternate" hreflang="nl-BE" href="https://www.example.com/nl-be/hardloopschoenen/" />
<link rel="alternate" hreflang="fr-BE" href="https://www.example.com/fr-be/chaussures-de-course/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />

The rules that matter

  1. Self-reference: every page lists itself
  2. Return links: if page A points to page B, page B must point back to A. Missing return links are the most common error
  3. Canonical URLs only: hreflang URLs must be the canonical, indexable 200-status versions
  4. Absolute URLs with protocol
  5. Equivalent content: link pages to their real counterpart, not all to the homepage

Implementation options

Method Best for
HTML <link> tags in the <head> Most websites
XML sitemap with xhtml:link Large sites, or when you cannot edit templates
HTTP headers Non-HTML files such as PDFs

Pick one method per page type and stick to it.

Sitemap example

<url>
  <loc>https://www.example.com/en/services/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/services/" />
  <xhtml:link rel="alternate" hreflang="nl" href="https://www.example.com/nl/diensten/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/en/services/" />
</url>

The sitemap needs the xmlns:xhtml="http://www.w3.org/1999/xhtml" namespace.

Platform tips

  • WordPress: multilingual plugins such as WPML and Polylang output hreflang automatically when translations are linked. Check that every translation is connected; unlinked translations get no hreflang
  • Shopify: Shopify Markets and translation apps output hreflang for markets and languages; check the result after configuring domains or subfolders
  • Magento 2: store views do not add hreflang to all page types out of the box; an extension or custom implementation is common, and mapping products and CMS pages across store views needs care

Should you redirect by IP or browser language?

Avoid automatic redirects based on IP or browser language. Search engine crawlers mostly crawl from one location and may never see your other versions. Show a banner suggesting the right version instead.

Testing hreflang

  • Crawl the site with a crawler that reports hreflang errors (missing return links, non-canonical targets, non-200 URLs)
  • Inspect key pages in Google Search Console to check canonical selection
  • Search from different countries (using a VPN or Google’s region settings) for your brand and key terms

Common errors

  • Missing return links
  • Hreflang pointing to redirected or noindex URLs
  • Wrong codes (en-UK, de-DE used for all German speakers when de would be better)
  • Mixing HTML and sitemap implementations with conflicting data
  • Canonical tags pointing all language versions to one language (this tells Google the others are duplicates)

Frequently asked questions

Do I need hreflang if I only have one language?

No. Hreflang is only for sites with alternative language or regional versions.

Is x-default required?

It is recommended, not required. It defines the fallback for users who do not match any listed version, often a language selector or your main version.

Subfolders, subdomains or separate domains?

All can work with hreflang. Subfolders (/nl/, /de/) are usually the easiest to manage and keep authority on one domain.

Need help with international SEO?

I set up and fix multilingual and multi-country SEO, including hreflang, for WordPress, Shopify and Magento. See my technical SEO service or request a review.