Bilingual & RTL ·

hreflang for Arabic and English sites, explained without jargon

What hreflang does, how to set it up for Arabic and English pages, and the quiet errors that break it, from invalid country codes to canonicals pointing the wrong way.

By Kareem Mohamed, Web Developer at Digital House

hreflang for Arabic and English sites, explained without jargon

If your site has Arabic and English pages, hreflang is how you tell Google they are the same page in two languages, so an Arabic searcher sees the Arabic version and an English searcher sees the English one. Setting up hreflang on an Arabic site is not hard, but small mistakes stop it working without any visible error. Here is what it does, how I set it up, and what to check.

What hreflang actually does

hreflang is an annotation: a short line of code that lists every language version of a page. It does not make a page rank higher, and it does not translate anything. It helps Google choose which of your existing pages to show each searcher, and it matters most when versions are similar, such as Arabic pages for Saudi Arabia and for the UAE.

Without it, Google usually works out the language from the content anyway. Where hreflang earns its place is in fixing results that show the wrong version: English pages appearing for Arabic searches, or a Saudi page showing to people in Dubai. On a bilingual site I set it up from day one, as part of the foundations in the bilingual website guide.

The codes: ar, en, and when to add a country

Each version is labelled with a language code, optionally followed by a country code. The language uses ISO 639-1 (two letters) and the country uses ISO 3166-1 alpha-2 (also two letters).

  • ar: Arabic, for anyone, anywhere.
  • en: English, for anyone.
  • ar-SA: Arabic for Saudi Arabia. ar-AE: Arabic for the UAE.
  • en-AE: English for the UAE.
  • x-default: the fallback page for anyone who matches none of the others, often your main language or a language chooser.

Do I need ar-AE and ar-SA, or just ar?

For most businesses, ar and en are enough. Add country codes only when the pages are genuinely different per country: Saudi prices in riyals and Emirati prices in dirhams, different delivery terms, different phone numbers. If one Arabic page serves everyone, labelling it ar-SA only narrows it for no benefit.

Code mistakes are common and silent. ar-UAE and ar-KSA are invalid, because country codes have two letters (AE, SA). en-UK is invalid too; the code for the United Kingdom is GB. And a country code on its own does not work: ae is read as a language code, and it belongs to Avestan, an ancient language, not the Emirates.

An hreflang checklist for Arabic and English sites: every page lists all versions including itself, links are returned both ways, codes are valid, an x-default is set, URLs are final and canonical, and the tags are in the HTML source.
An hreflang checklist for Arabic and English sites: every page lists all versions including itself, links are returned both ways, codes are valid, an x-default is set, URLs are final and canonical, and the tags are in the HTML source.

How to add hreflang: three methods

Google reads hreflang from three places. Choose one method and use it consistently, because mixing them makes errors much harder to find (Google’s documentation on localised versions).

1. Link tags in the page head. The most common method. The Arabic page and the English page carry the same set of tags, each including itself:

<!-- the same three lines on /ar/services/ and on /en/services/ -->
<link rel="alternate" hreflang="ar" href="https://example.com/ar/services/" />
<link rel="alternate" hreflang="en" href="https://example.com/en/services/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/ar/services/" />

2. The XML sitemap. Each URL lists its alternates with xhtml:link entries. This suits large sites, such as a magazine or a store with thousands of pages, because the page head stays clean and the whole set is generated in one place.

3. HTTP headers. Useful for files with no HTML head, such as the Arabic and English versions of a PDF brochure.

The errors that quietly break it

Search Console no longer has a dedicated international targeting report, so hreflang mistakes rarely announce themselves. These are the ones I find most often:

  • No return link. The Arabic page points to the English one, but the English page does not point back. Google ignores pairs that are not confirmed from both sides.
  • A canonical pointing to the other language. If /ar/services/ has a canonical tag pointing to /en/services/, you are telling Google the Arabic page is a copy, and it can drop out of the index.
  • Targets that redirect, return 404 or are set to noindex, often after a redesign changed the URLs and nobody updated the tags.
  • Everything pointing at the homepage. Every English page pointing to the Arabic homepage, for example. Each page must point to its own equivalent.
  • Encoding mismatches with Arabic URLs, where the hreflang URL is encoded differently from the canonical. Generate both from the same source; more in Arabic URLs or English slugs.
  • Tags added only by JavaScript after the page loads. Google can render JavaScript, but tags in the HTML the server sends are more reliable.

Does my platform add hreflang for me?

Often, yes, but do not assume it is right. WordPress translation plugins such as WPML and Polylang add hreflang tags for the languages you publish, and Shopify adds them for the languages enabled in your store. Custom builds need them generated in code, ideally from the same route list that produces the sitemap, so a new page gets its tags automatically.

Automatic does not mean correct. The plugin only knows about the pairs you have linked, so an Arabic page created on its own, without being connected to its English twin, gets no alternate. Country codes come from settings someone chose years ago. And if your SEO plugin sets a canonical that disagrees with the translation plugin, the two send Google opposite signals. After any change of theme, plugin or URL structure, check a handful of pages by hand.

How to check your hreflang set-up

View the page source (not the browser inspector, which shows the page after JavaScript has run) and confirm the tags are there. Then open each URL in the set and confirm it returns the same tags. On larger sites, an SEO crawler such as Screaming Frog reports missing return links and non-canonical targets across every page.

In Search Console, the URL Inspection tool shows which canonical Google chose for a page. If Google picked the English page as the canonical for an Arabic URL, something on the site is sending mixed signals, and hreflang alone will not fix it.

hreflang is one part of Arabic SEO and of a wider technical SEO checklist. Check it again after every redesign or platform move; website migration without losing rankings explains why.