If your site has an English and an Arabic version, search engines need to know that the two pages are alternatives for each other. The hreflang attribute says so. It is simple in principle and easy to get wrong in practice.
What hreflang does
It tells search engines that a page is available in another language or region, and gives the URL of that version. The goal is to show the Arabic page to Arabic searchers and the English page to English searchers, without treating the two as duplicates.
The basic rules
Every language version must list all the other versions, including itself. Each page needs a return link from the other page. If the English page points to the Arabic page, the Arabic page must point back to the English page. Missing return links are the most common error.
Example for a bilingual page
An English page at /services/seo should include a hreflang link for en pointing to itself, and a link for ar pointing to /ar/services/seo. The Arabic page includes the same two links. Add an x-default link for the fallback version when there is one.
Use full URLs
hreflang values must be absolute URLs, including the protocol and domain. Relative paths do not work, and mixing http and https creates inconsistent signals.
Keep the canonical consistent
Each language version should canonicalise to itself. Pointing the Arabic page's canonical to the English page tells search engines to ignore the Arabic version, which defeats the purpose.
Do not redirect by browser language
Automatically sending visitors to a language based on their browser settings can stop search engines from reaching the other version. Let each URL stay accessible, and offer a visible language switch instead.
Check the setup
Test a sample of pages with a validator, confirm the links are reciprocal, and check Search Console for language-related issues after launch. Errors are usually easy to spot once you look for them.
Good hreflang setup takes an hour on a small site and is worth doing from the first release, because it is much harder to clean up after both versions are already indexed.
