← Back to blog

15 January 2026 · Youssef Ettobi

Hreflang for Arabic: How to Configure It Correctly Across 22 Countries

Implementing hreflang for an Arabic website is one of the areas where the most mistakes are made. Not because it is difficult, but because Arabic has particularities that do not exist in other languages: 22 markets that share a language but with different search behaviours, dialects that have no official ISO code, and the RTL convention that affects the lang attribute of the HTML.

This guide covers the correct implementation from scratch.

Why hreflang in Arabic is not like other languages

In most multilingual projects, hreflang is configured by language: es for Spanish, en for English, fr for French. Each language has a relatively clear market.

With Arabic, the problem is this: ar covers 22 countries. A user searching on Google.ae (UAE) has completely different purchase intentions, purchasing power and dialects to a user on Google.ma (Morocco). If you serve the same content to both, you are not optimising — you are generalising.

The question to ask before configuring hreflang is: do I have differentiated content by Arabic market, or do I have a single version in standard Arabic?

The most common situation for European projects entering the Arabic market is the former: a single version in Modern Standard Arabic (MSA). This simplifies the implementation.

Correct structure for an ES + AR website

Assuming a website with a Spanish version and an Arabic version, the correct implementation in the <head> is:

<!-- Spanish page -->
<link rel="alternate" hreflang="es" href="https://yourdomain.com/es/page/" />
<link rel="alternate" hreflang="ar" href="https://yourdomain.com/ar/page/" />
<link rel="alternate" hreflang="x-default" href="https://yourdomain.com/es/page/" />

<!-- Arabic page -->
<link rel="alternate" hreflang="es" href="https://yourdomain.com/es/page/" />
<link rel="alternate" hreflang="ar" href="https://yourdomain.com/ar/page/" />
<link rel="alternate" hreflang="x-default" href="https://yourdomain.com/es/page/" />

Basic rules that must always be followed:

  1. The relationship is bidirectional. If the ES page points to the AR page, the AR page must point back to the ES page. If either direction is missing, Google ignores the signal.
  2. Each page includes itself. The ES page points to both ES and AR. The AR page points to both AR and ES.
  3. x-default points to the default version, usually ES or EN.

The HTML lang attribute in Arabic

In addition to hreflang in the <head>, the <html> element needs the correct lang attribute:

<html lang="ar" dir="rtl">

The dir="rtl" attribute does not directly affect SEO, but it does affect rendering. Google uses lang to confirm the language of the page. If hreflang says ar but <html> has lang="es", Google may ignore the hreflang signal or assign the wrong language.

Region-based structure: when to use country codes

If the project scales to differentiated content by country, the codes are:

Markethreflang
Saudi Arabiaar-SA
United Arab Emiratesar-AE
Egyptar-EG
Moroccoar-MA
Kuwaitar-KW
Qatarar-QA
Jordanar-JO
Iraqar-IQ
Lebanonar-LB
Algeriaar-DZ

Implementation in sitemap vs <head>

There are two ways to declare hreflang: in the <head> of each page or in the XML sitemap. Both are valid for Google.

In the <head>: easier to maintain in frameworks like Astro, Next.js or Nuxt where the layout is centralised.

In the sitemap: useful when the CMS does not allow easy modification of the <head>. The format is:

<url>
  <loc>https://yourdomain.com/es/page/</loc>
  <xhtml:link rel="alternate" hreflang="es" href="https://yourdomain.com/es/page/"/>
  <xhtml:link rel="alternate" hreflang="ar" href="https://yourdomain.com/ar/page/"/>
  <xhtml:link rel="alternate" hreflang="x-default" href="https://yourdomain.com/es/page/"/>
</url>

Most common mistakes in projects with Arabic

Mistake 1: using ar-Arab as the script code. ar-Arab refers to the script (Arabic alphabet), not a market. Google does not recognise it as a valid hreflang signal.

Mistake 2: hreflang in one direction without the response in the other. The most common error. The ES page points to AR, but the AR page has no hreflang block configured.

Mistake 3: canonical and hreflang in conflict. If the AR page has a canonical pointing to the ES version, Google prefers the canonical and discards the hreflang. Each language version must have its own canonical pointing to itself.

Mistake 4: omitting x-default. Without x-default, Google does not know what to show to users from countries that have no specific version.

Mistake 5: URLs with parameters in hreflang. The ideal is to structure by directories (/ar/) to avoid crawl budget issues.

How to verify that hreflang is working

  1. Google Search Console → Pages → select a URL → view coverage. If hreflang is correct, Google shows the linked alternative pages.
  2. Hreflang report in GSC (International Targeting). Shows specific errors.
  3. Manual validation with curl: curl -s "https://yourdomain.com/ar/page/" | grep hreflang.

The time between implementation and reflection in GSC is between 1 and 4 weeks.

If you want us to review the hreflang of your website before launching the Arabic version, request your free audit.

Want to rank in Arabic markets?

Request your free audit and we will respond within 48 hours.

Request free audit