Skip to content
Beytullah Toprak

Blog

How to Set Up hreflang Correctly on a Multilingual Site

What hreflang is, how to write it, which setup method to use and the most common mistakes. A step-by-step guide to multilingual SEO.

Reading time
7 min read
Categories
Multilingual pages illustration with two equivalent documents joined by a chain link
On this page
  1. What Is hreflang and Why Do You Need It?
  2. How to Write hreflang
  3. Three Ways to Set It Up
  4. Rules to Follow
  5. When Not Every Page Is Translated
  6. Automatic Language Redirects
  7. Language Switcher and URL Structure
  8. Common Mistakes
  9. How to Check It
  10. Frequently Asked Questions
  11. Does hreflang Improve Rankings?
  12. What Should I Do With Pages That Aren't Translated?
  13. Can I Use Machine Translation?

hreflang is a signal that tells search engines about the different language or regional versions of a page. Set up correctly, it lets Google show the Turkish version of a page to someone searching in Turkish and the English version to someone searching in English. Multilingual SEO rests on three rules: each language version needs its own URL, each version must list itself and all the others, and the links must go both ways. This post explains how to set up hreflang, which method to use when and the most common mistakes.

What Is hreflang and Why Do You Need It?

hreflang tells Google which address holds the same page for which language and region, so users can be shown the version in their own language. Without it, Google can't always tell that a Turkish page and an English page are equivalents.

Google's documentation on multilingual sites (opens in a new tab) recommends using a separate URL for each language version, rather than switching the page language with cookies or browser settings, and linking those URLs with hreflang. So the prerequisite for hreflang is that every language has its own address, such as /tr/blog/... and /en/blog/....

How to Write hreflang

An hreflang value is a language code followed by an optional region code. According to Google's documentation on localized versions (opens in a new tab), the language code uses ISO 639-1 format, the region code uses ISO 3166-1 Alpha 2, and you can't specify a country code on its own.

Value Meaning
tr Turkish, all regions
en English, all regions
en-GB English speakers in the United Kingdom
de-CH German speakers in Switzerland
x-default Default page for languages not on the list

Most sites don't need a region code. For a site that publishes in Turkish and English, tr and en are enough. A region code makes sense when you serve different content to different countries in the same language: different prices, currencies or legal text.

Three Ways to Set It Up

According to Google's documentation, there are three ways to declare alternate versions. All three are equivalent from Google's perspective, so pick the one that's easiest for you to maintain:

Method How Where it usually fits
HTML <link rel="alternate" hreflang="..."> tags in the page's <head> The easiest option for most websites
HTTP header A Link header in the server response Non-HTML files such as PDFs
Sitemap xhtml:link elements under each URL Many pages and languages

For a blog post in Turkish and English, the HTML method looks like this:

html
<link rel="alternate" hreflang="tr" href="https://example.com/tr/blog/hreflang-rehberi" />
<link rel="alternate" hreflang="en" href="https://example.com/en/blog/hreflang-guide" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/blog/hreflang-guide" />

The same set of tags must appear on both pages. Notice that the last part of the two URLs differs. Using a URL in each language's own words is fine; what matters is that the hreflang tags pair those different URLs correctly.

Rules to Follow

  • Each version must list itself. According to Google's documentation, each language version should list itself as well as all the other versions.
  • Links must go both ways. If the Turkish page points to the English page, the English page must point back to the Turkish one. The documentation lists missing return links among the most common mistakes.
  • URLs must be complete. Alternate URLs should be fully qualified, including https://.
  • Consider x-default too. When a visitor's language isn't on the list, x-default decides which page they see. It can be the default language version or a language picker page.
  • Keep canonical tags consistent. Google's canonicalization documentation (opens in a new tab) recommends specifying a canonical page in the same language when you use hreflang, so each language version's canonical should point to itself. Pointing the Turkish page's canonical at the English page can get the Turkish page dropped from the index.

When Not Every Page Is Translated

On multilingual sites, not every page has an equivalent in every language. Google's documentation says that if providing a complete set of bidirectional links becomes difficult, you can leave some languages off some pages, and Google will still process the pages that point to each other. So you don't need to invent an English hreflang for a post published only in Turkish. The documentation also stresses that newly added language pages should at least link both ways with the main language pages.

The documentation also lists, among recommended scenarios for declaring alternates, pages where only the template (such as navigation and footer) is translated while the main content stays in one language. That might apply to a forum page where user comments stay in one language.

Automatic Language Redirects

Checking a visitor's browser language and automatically sending them to another language version is tempting. Google's multilingual sites documentation recommends avoiding this, because such redirects can keep users and search engines from seeing all versions of the site. It suggests adding a language switcher that links to the other versions instead.

In practice, many sites redirect visitors to a suitable language from the unprefixed root (example.com/). If you do that, at least never redirect language-prefixed URLs (/tr/..., /en/...), and keep a visible language switcher on every page. That way every version stays directly reachable.

Language Switcher and URL Structure

When each language version has its own URL, users need to be able to switch to the same page in the other language with one click. The switcher should take them to the equivalent page, not the home page. For URL structure, you can use subdirectories like /tr/ and /en/, subdomains or country-specific domains. Google's multilingual sites documentation lists the pros and cons of each. Subdirectories are easy to set up and cheap to maintain. On the downside, they sit on a single server location and are harder to split apart later. In my view they're still a practical choice for most small and mid-sized sites.

Common Mistakes

  • Missing return links: one version points to another, but not the other way around.
  • Wrong codes: writing en-UK for the United Kingdom. The correct code is en-GB. According to Google's documentation, an invalid region part is ignored, so the page is effectively treated as plain en.
  • A country code on its own: a region code always comes with a language code. For Turkish speakers in Turkey you write tr-TR; TR alone isn't valid.
  • Adding hreflang for pages that have no translation, or pointing every page to the home page of the other language.
  • Another common problem in practice is using an hreflang URL that redirects, is noindex or has a canonical pointing elsewhere.

How to Check It

After setup, open the source of a few pages and check the tags by eye: does every page have the same set, does every URL load, are the URLs consistent with the canonicals? Google's documentation notes that third-party tools can also help debug hreflang errors. If you use the sitemap method, confirm that Search Console processes the sitemap without errors.

hreflang is part of a broader technical SEO effort. I collected the other items in the technical SEO checklist. I describe how I built this site's bilingual setup in this site's SEO and GEO setup.

Frequently Asked Questions

Does hreflang Improve Rankings?

Google's documentation describes hreflang as a signal that helps show users the right language version. Its indirect benefit is a better experience when users reach the page in their own language.

What Should I Do With Pages That Aren't Translated?

If a page exists in only one language, you don't need to add hreflang to it. hreflang should only link pages that truly have equivalents.

Can I Use Machine Translation?

Technically, hreflang works either way. But low-quality machine translation produces a page with little value for readers. Text that reads naturally in each language is better for both users and search visibility.

If you'd like to review your multilingual site's SEO setup together, see the SEO and Performance Marketing service or write to me through the contact page.

Share