Hreflang and international SEO: how to set up a multilingual website correctly
When a website has several language versions, Google needs to know which one belongs to which audience. Without that, one of two things happens: either the versions are treated as duplicates of each other, or a Slovak user is shown the Czech page. This is what the hreflang attribute is for, and this guide shows how to set it up and what to avoid.
1. When you really need hreflang
Hreflang is a signal that says: "this page has an equivalent version in another language or for another country." It is not an instruction to show a page or a tool for improving rankings; it is a map of the relationships between versions.
You need it if at least one of these applies:
- You have the same content in several languages (for example Slovak and English).
- You have the same language for several countries, typically German for Germany, Austria and Switzerland, or English for the UK and the US with different prices and currencies.
- You have a Slovak and a Czech version. These are very similar languages, and this is exactly where hreflang is useful: without it, Google has no clear instruction on which version to show to whom.
💡 You do not need it if you have one language version. A Slovak website for Slovak customers does not deal with hreflang. You also do not need it for pages that exist in only one language, even if the rest of the website is multilingual.
2. Which domain structure to choose
This decision is made once and is hard to change, so it is worth thinking through. There are three options:
| Structure | Example | Advantage | Disadvantage |
|---|---|---|---|
| Subdirectory | firma.sk/cz/ | Easy setup, low maintenance on a single host | According to Google: users may not recognize the targeting from the URL, a single server location, harder to separate the sites |
| Subdomains | cz.firma.sk | Easy setup, option of a different server location, easy to separate the sites | According to Google: users may not recognize the targeting from the URL (is "de" a language or a country?) |
| Country-code domains | firma.sk + firma.cz | Clear country targeting. Google states that a country-code domain is a strong signal to users and search engines that the site is intended for that country | According to Google: more expensive, higher infrastructure demands, sometimes strict registration requirements and targeting of only one country |
Recommendation for most companies: subdirectories. Google describes them as a solution with easy setup and low maintenance. Country-code domains only make sense when you have a separate operation in the given country, different prices, a different product range and a budget for building links separately for each of them.
3. How to write hreflang correctly
The markup belongs in the <head> section, and on every page it must list all versions, including the page itself. Example for a Slovak, Czech and English version:
<link rel="alternate" hreflang="sk" href="https://firma.sk/sluzby/">
<link rel="alternate" hreflang="cs" href="https://firma.sk/cz/sluzby/">
<link rel="alternate" hreflang="en" href="https://firma.sk/en/services/">
<link rel="alternate" hreflang="x-default" href="https://firma.sk/en/services/">
Three rules that must all apply at the same time:
- Bidirectionality. If page A links to B, B must link back to A. Google puts it precisely: if two pages do not point to each other, the affected annotations are ignored. So it is not the whole markup on the page, but those links that are not bidirectional.
- Self-reference. Every page also lists its own version. Without it, the markup is not valid.
- Absolute URLs including the protocol. Relative paths do not work.
The language code follows ISO 639-1 and the country code follows ISO 3166-1 alpha-2. Watch out for two common mistakes: Czech is cs, not cz; and the United Kingdom is gb, not uk. A country code on its own without a language (hreflang="cz") is invalid.
💡 What x-default is: a fallback version for visitors whose language does not match any of the listed versions. It is typically set to the English version or to a language selection page. It is not mandatory, but it is recommended.
4. Five mistakes that break it
- A missing return link. The most common mistake of all. It happens when a new language version is added and someone forgets to add it to the existing pages.
- A conflict with the canonical link. If the Czech page has a canonical link pointing to the Slovak one, you are telling Google two contradictory things at once: that they are equivalent language versions and that the Czech one is a duplicate. Localized versions should therefore not be canonicalized to one of them; the canonical link should point to the page itself (Consolidate duplicate URLs).
- Hreflang pointing to a page Google will not include. If the target URL carries
noindex, according to the documentation Google drops it from the results completely, so it cannot be shown as an alternate version. If it is disallowed in robots.txt, the crawler will not go through it and will not see the annotation on it. - Automatic redirects based on IP address. It looks helpful, but there is a catch: Google's starter guide states that its crawler works mostly from the United States. If you redirect based on location, the crawler will usually see only one version. Instead of a redirect, offer an unobtrusive prompt to switch language.
- Machine translation without review. This is not a hreflang error, but a reason for failure. A poor-quality language version will not rank, even if it is technically set up without a flaw.
⚠️ Be especially thorough with Slovak and Czech. The languages are so close that without correct hreflang, Google mixes up the versions or treats one as a duplicate. The result is that Czech users are shown the Slovak page and vice versa.
International SEO is an extension of regular optimization, not a replacement for it. You will find the basics in the overview SEO.
Related: Duplicate content · Website structure and URLs · 301 redirects
Sources
- Google Search Central: Localized versions of your pages, rules for writing hreflang, bidirectionality and x-default (verified August 2026).
- Google Search Central: Managing multi-regional and multilingual sites, a comparison of country-code domains, subdomains and subdirectories, and the statement that a country-code domain is a strong country-targeting signal.
- Google Search Central: Consolidate duplicate URLs, the canonical link for language versions.
- Google Search Central: Block search indexing with noindex, a page with a
noindextag is dropped from the results completely. - Google Search Central: SEO Starter Guide, Google's crawler works mostly from the United States.
- Language codes follow the ISO 639-1 standard and country codes follow ISO 3166-1 alpha-2. The list of valid values is maintained by the International Organization for Standardization; its website returns a 403 error to bots, so we do not link to it here.
FAQ
Do I need hreflang if I have a Slovak and a Czech version?
Yes, that is exactly where it is needed most. Slovak and Czech are so similar that without hreflang, Google often mixes up the versions or treats one as a duplicate. The result is that the wrong language version is shown.
Is the code for Czech "cs" or "cz"?
For the language, it is "cs" according to the ISO 639-1 standard. "cz" is a country code and on its own is invalid in hreflang. If you want to target Czech in the Czech Republic, the correct notation is "cs-cz".
Should I automatically redirect visitors by country?
It is not recommended. The crawler usually comes from US servers, so it would only ever see one version and would not discover the others. A better solution is to leave the user on the page they chose and offer an unobtrusive prompt to switch language.
Will hreflang improve my rankings in search?
Not directly, since it is not a ranking factor. But it prevents language versions from competing with each other or being treated as duplicates, and it makes sure the right version is shown to the right audience. That has an indirect effect on both traffic and conversions.