Hreflang Explained: How to Set It Up Step by Step
What hreflang does, the rules that make it work, a copy-ready example for three languages, and the mistakes that quietly break it.

"Hreflang is a small piece of markup with a big job. It tells search engines that a page has equivalents in other languages or regions, and where to find them. Get it right and each visitor lands on the version written for them. Get it wrong and Google may show the wrong language, or treat your translated pages as duplicates of each other.
What hreflang does (and what it does not)
Hreflang does not translate anything, and it does not make a page rank higher. If your Italian page is thin or slow, hreflang will not fix it. What it does is help Google choose the right version of a page for the person searching, based on their language and, when you ask for it, their country.
You need it if your site has more than one language, or if you serve the same language to different countries with different content, such as prices, currency or shipping rules. A single-language site does not need it.
The three ways to add hreflang
| Method | Where it goes | Best for |
|---|---|---|
| HTML link tags | In the head of every page | Most websites, easy to check |
| HTTP headers | In the server response | Files that are not HTML, such as PDFs |
| XML sitemap | In sitemap.xml, with xhtml:link entries | Large sites, one central place to manage |
Pick one method and keep it consistent. Two methods that disagree with each other are a common source of errors.
The rules that make it work
- Every version lists all versions, including itself. The English page lists the English, Italian and Turkish pages. So does the Italian page, and so does the Turkish one.
- Links must be reciprocal. If page A points to page B, page B must point back to page A. Google ignores one-way annotations.
- Use absolute URLs. Include the protocol and the domain, not just the path.
- Use valid codes. The language comes first, as a two-letter ISO 639-1 code (
en,it,tr). A region is optional and comes second, as an ISO 3166-1 code (en-GB,en-US). The United Kingdom isGB, soen-UKis wrong. - Point only to pages that can be indexed. Each target should return a normal 200 response, have no noindex, not redirect, and use itself as its canonical URL.
- Add an x-default. It names the fallback page for visitors whose language you do not cover. This is often your main version or a language selector.
A copy-ready example
This is what the head of each of the three versions of one article looks like. The block is identical on all three pages, which is exactly what makes the links reciprocal.
<link rel=""alternate"" hreflang=""tr"" href=""https://cosiagency.com/insights/ajans-web-sitesi-hiz-calismasi/"" />
<link rel=""alternate"" hreflang=""en"" href=""https://cosiagency.com/en/insights/agency-website-speed-study/"" />
<link rel=""alternate"" hreflang=""it"" href=""https://cosiagency.com/it/insights/studio-velocita-siti-agenzie/"" />
<link rel=""alternate"" hreflang=""x-default"" href=""https://cosiagency.com/insights/ajans-web-sitesi-hiz-calismasi/"" />

Language only, or language plus region?
Use the language alone (en) unless the content really differs by country. en-GB and en-US make sense when prices, spelling or legal text are different. Otherwise, regional versions only add pages to maintain and more places to make mistakes.
Mistakes that break hreflang
- Missing return links. The most common error. One side points, the other does not.
- Wrong codes. Japanese is
ja, notjp. The UK isen-GB, noten-UK. - Pointing to the wrong kind of page. Redirected pages, error pages, noindex pages and pages whose canonical points somewhere else are all ignored.
- Linking untranslated pages. If the ""Italian"" page still shows English text, it should not be presented as the Italian version.
- Redirecting visitors automatically by IP address or browser language. Googlebot crawls mostly from the United States and may never see your other versions. Let people choose with a language switcher instead.
Multilingual sites are also often slower. In our speed study of 324 agency websites, WordPress sites using the WPML multilingual plugin averaged 58 on mobile, below the overall average of 61.
How to check your setup
- Open the page source and confirm that each page lists every version, including itself.
- Crawl the site with a tool such as Screaming Frog or Sitebulb. Both report missing return links and invalid codes.
- Use URL Inspection in Google Search Console to see which URL Google chose as the canonical. Search Console no longer has a dedicated hreflang report, because the old International Targeting report was retired.
- Check again after every redesign, migration or change of URL structure.
What we do on our own site
cosi publishes in Turkish, English and Italian, and every article exists in all three languages. Our publishing tool adds a language to the hreflang set only if that page is published, indexable and uses its own URL as the canonical. If a translation is not ready, the tag is simply not added, so we never link to a page that does not exist.
Summary
- Hreflang helps Google show the right language version. It is not a ranking boost.
- Every version lists all versions, including itself, and every link is returned.
- Use valid codes, absolute URLs and indexable target pages.
- Add
x-default, and never redirect visitors automatically by location. - Re-check after every site change.
If your site serves several countries and you are not sure it is set up correctly, we can review it. See our international and multilingual SEO service, or request a free analysis. If a redesign is also on the table, our web design and development team builds multilingual sites with hreflang from day one."