🌍 Hreflang Implementation Guide

Master international SEO with proper language targeting

What Is Hreflang?

Hreflang is an HTML attribute used to indicate the language and geographical targeting of a webpage. It helps search engines serve the correct language version of a page to users in different countries or speaking different languages.

Without proper hreflang implementation, Google might show the wrong language version to users, leading to poor user experience and potential duplicate content issues.

🌐
Language Targeting

Show English content to English speakers

📍
Geo Targeting

Show UK English to UK users, US English to US users

🔗
Avoid Duplicates

Signal variations are related, not duplicate content

📝 Hreflang Format

hreflang="
en
Language Code
(ISO 639-1)
-
GB
Region Code
(ISO 3166-1 Alpha-2)
"
🗣️ Language Only
en English (any country)
es Spanish (any country)
fr French (any country)
de German (any country)
🌍 Language + Region
en-GB English for United Kingdom
en-US English for United States
es-MX Spanish for Mexico
pt-BR Portuguese for Brazil

⚙️ Implementation Methods

Recommended

HTML Link Tags

Add link tags in the <head> section of your HTML. Best for most websites.

<link rel="alternate" hreflang="en" href="https://example.com/page/"> <link rel="alternate" hreflang="es" href="https://example.com/es/page/"> <link rel="alternate" hreflang="x-default" href="https://example.com/page/">
Large Sites

XML Sitemap

Add hreflang to your sitemap. Best for large sites with many pages.

<url> <loc>https://example.com/</loc> <xhtml:link rel="alternate" hreflang="en" href="https://example.com/"/> <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/> </url>
HTTP Headers

HTTP Headers

Use HTTP headers for non-HTML files (PDFs, images).

# .htaccess or server config Link: <https://example.com/file.pdf>; rel="alternate"; hreflang="en" Link: <https://example.com/es/file.pdf>; rel="alternate"; hreflang="es"

🌐 x-default Explained

The x-default value is a special hreflang attribute that designates the fallback page for users who don't match any of your other language/region targeting.

<link rel="alternate" hreflang="x-default" href="https://example.com/page/">
🌍
Language selector pages where users choose their language
🔀
Pages that auto-detect and redirect based on location
📄
Default version for users from countries you don't target
Usually points to your English or main language version

⚠️ Common Hreflang Errors

❌ Missing Return Links

Every page must link back to the originating page. If Page A links to Page B, Page B must link back to A.

✅ Ensure bidirectional hreflang links on all pages
❌ Wrong Language Codes

Using invalid codes like "uk" for Ukrainian (should be "uk" or "ua" for region). Country ≠ Language!

✅ Use ISO 639-1 for language, ISO 3166-1 Alpha-2 for region
❌ Missing Self-Reference

Each page should include a hreflang link pointing to itself for its own language.

✅ Include self-referencing hreflang on every page
❌ Conflicting Signals

Having hreflang pointing to a different URL than the canonical tag.

✅ Ensure hreflang URLs match canonical URLs
❌ Non-Absolute URLs

Using relative URLs instead of full absolute URLs with protocol.

✅ Always use absolute URLs: https://example.com/page/
❌ Broken Links

Hreflang pointing to pages that return 404 or redirect.

✅ All hreflang URLs must return 200 status code

🛠️ Hreflang Testing Tools

🔍

Hreflang Tags Testing Tool

Test hreflang implementation

By TechSEO
📊

Google Search Console

International targeting reports

Free
🦎

Screaming Frog

Crawl and audit hreflang

Freemium
🔧

Ahrefs Hreflang Checker

Validate implementation

Paid

📋 Hreflang Checklist

Setup

Validation

Monitoring