Multilingual SEO for Ecommerce: hreflang Basics
When your online store has versions in several languages or for several countries, search engines need help to show each shopper the right one. That is the job of hreflang. This guide explains the basics in plain language: how hreflang works, which codes to use, how to structure your URLs and which mistakes to avoid. It is general guidance, and search engines can change how they treat these signals.
Key takeaways
- hreflang tells search engines which language or region version of a page to show, for example de-DE, de-AT or fr-BE.
- Each version should reference all the other versions and itself, so the set is complete and confirmed from every page.
- Use separate URLs for each language or country version: subfolders, subdomains or country domains.
- Add an x-default version for shoppers whose language or region you do not specifically target.
- Do not force shoppers into a version by automatic redirect; let them choose and switch.
Imagine a shopper in Vienna searching for a product you sell. You have a German-language page for Germany with prices and delivery for Germany, and another for Austria. Without clear signals, a search engine may show the German page to the Austrian shopper, who then sees the wrong delivery information. They may leave, or order and be disappointed.
hreflang is the signal that solves this. It does not make your pages rank higher by itself, but it helps search engines match the right version to the right shopper. For any online store selling across Europe in several languages, it is one of the most useful technical SEO tasks to get right.
What hreflang does and does not do
hreflang is an annotation that says, in effect: "This page also exists in these other languages or for these other regions, and here are their addresses." Search engines that support it can then show the version that best fits the searcher's language and location.
It is worth being clear about its limits:
- It is a signal, not a command. Search engines use it as a strong hint, but they make the final choice.
- It does not translate anything. Each version must actually be in the right language, with content suited to that market.
- It does not fix duplicate content on its own. If your Germany and Austria pages are identical, including price and delivery details, there is little reason for them to exist as separate versions.
- Not every search engine uses it in the same way. Check the documentation for the search engines that matter in your markets.
Language and region codes
hreflang values combine a language code and, optionally, a region code. The language comes first in two lowercase letters, for example de for German or fr for French. The region, if used, follows in two letters, usually written in uppercase, for example DE for Germany or AT for Austria.
| Value | Meaning | When to use it |
|---|---|---|
| de | German, any region | One German version for all German speakers |
| de-DE | German, for Germany | A German version with prices and delivery for Germany |
| de-AT | German, for Austria | A German version tailored to Austrian shoppers |
| fr-BE | French, for Belgium | A French version for Belgian shoppers |
| nl-BE | Dutch, for Belgium | A Dutch version for Belgian shoppers |
| en-GB | English, for the United Kingdom | An English version with UK prices and delivery |
| x-default | Fallback | A page for shoppers not matched by any other version, such as a country selector or your main site |
Common mistake
Writing en-UK instead of en-GB, or using a region code on its own without a language. The region code for the United Kingdom is GB, and hreflang always needs a language. Invalid codes are typically ignored, so the annotation silently does nothing.
How to choose your URL structure
hreflang needs a separate URL for each language or country version. Showing different languages on the same URL, for example based on a cookie or browser setting, makes it hard for search engines to find and index each version. There are three common structures.
Subfolders
For example, example.com/de-de/ and example.com/fr-be/. All versions live on one domain, which is usually the simplest to manage for a small shop, and many ecommerce platforms support it directly.
Subdomains
For example, de.example.com and fr.example.com. These can be useful if versions run on different systems, but they are often more work to set up and manage.
Country domains
For example, example.de and example.fr, known as country-code top-level domains or ccTLDs. They send a strong local signal to shoppers, but each domain must be bought and managed separately, and some country domains have their own registration rules.
Pro tip
For most small stores, subfolders on one domain are the practical starting point. Name them consistently, for example language-country in lowercase, and keep the same path for the same product across versions where you can. That makes your hreflang annotations much easier to generate and check.
How to add hreflang to your store
There are three common ways to add hreflang annotations. Use one method consistently rather than mixing them.
- Link tags in the page head. Each page lists all its versions, including itself, in its HTML head section. This is the most common method and many ecommerce platforms and plugins generate it automatically.
- XML sitemap. The sitemap lists each URL together with its alternate versions. This keeps page code lighter and suits large catalogs.
- HTTP headers. Used mainly for files such as PDFs that do not have an HTML head.
A link tag for a German page aimed at Austria looks like this in plain text: <link rel="alternate" hreflang="de-AT" href="https://example.com/de-at/product/" />. The page would contain one such line for each version, plus one with hreflang="x-default".
- Map your versions. List every language and country version you have, with the code you will use for each.
- Match pages across versions. For each product and category, record the URL in every version. Missing equivalents are common, so note them.
- Add the full set to every page. Each page lists every version, including itself. If page A points to page B, page B must point back to page A.
- Add x-default. Choose a fallback page for unmatched shoppers, such as your main site or a country selector.
- Check canonicals. Each version should have a canonical tag pointing to itself, not to another language version.
- Test and monitor. Use search engine webmaster tools and an SEO crawler to find missing return links, invalid codes and URLs that redirect or return errors.
Example
For example, a small shop sells in Germany, Austria and Belgium. It has four versions: de-DE, de-AT, fr-BE and nl-BE, plus a country selector page as x-default. Each product page therefore carries five hreflang lines: four for the versions, including itself, and one for x-default. When it adds a new product only to the German and Austrian versions, the hreflang set on those two pages lists only those two versions and x-default, not pages that do not exist.
Redirects, country selectors and EU rules
Many stores are tempted to redirect visitors automatically to a version based on their IP address or browser language. For search engines, this can hide versions from crawlers that visit from one location. For shoppers, it can be frustrating, especially for people traveling or living in another country.
There is also a legal angle in the EU. Under the Geo-blocking Regulation (EU) 2018/302, you may not block EU customers or automatically redirect them to another version of your site based on nationality or residence without their consent. If you redirect someone, the original version must remain easily accessible.
A friendlier approach is to suggest a version with a small banner, such as "It looks like you are in Austria. Go to our Austrian store?", and let shoppers choose. Add a visible country and language switcher, usually in the header or footer, that works on every page.
Your hreflang action plan
- Decide your versions and give each a valid language or language-region code
- Give every version its own URL, preferably in consistent subfolders
- Add complete, reciprocal hreflang sets including a self-reference and x-default
- Set self-referencing canonical tags on each version
- Replace automatic redirects with a suggestion banner and a visible switcher
- Make sure country versions differ where it matters: prices, currency, delivery
- Check for errors in webmaster tools after each major site change
Frequently asked questions
Do I need hreflang if I only have two languages?
It still helps. With an English and a German version, for example, hreflang makes it more likely that German speakers see the German page in search results. The setup is simple with two versions, so it is a good habit to start early.
Should I target languages or countries?
Target countries when prices, currency, delivery or legal information differ between them, which is common in ecommerce. Use a language-only code when one version genuinely serves all speakers of that language.
Can my ecommerce platform add hreflang automatically?
Many platforms and translation plugins can generate hreflang tags. Still check the output: look at the code on a few product and category pages, and confirm that codes are valid, every version is listed and the URLs do not redirect.
Does hreflang help my rankings?
Not directly. It helps search engines show the right version to the right shopper, which can improve click-through and conversions. Rankings still depend on content quality and other SEO factors in each language.
Related reading
The bottom line
hreflang is how you tell search engines which version of your store belongs to which language and country. Give each version its own URL, use valid codes, list every version on every page including itself, add x-default and let shoppers choose rather than forcing redirects. Get those basics right and your localized pages have a fair chance to reach the shoppers they were made for.
Search engine guidelines change, and EU rules such as the Geo-blocking Regulation are applied nationally. Check the search engines' official documentation and the European Commission's Your Europe pages, and ask a specialist if you are unsure how the rules apply to your store.