#Crawlers never seeing the non-english default locale in next-intl?

1 messages · Page 1 of 1 (latest)

nocturne sage
#

Am I correct that crawlers will never see my default locale which has no prefix. For example, my default locale is "ar" and the other locale is "en". Arabic is here "/" while english is here "/en". next-intl's default priority for determining the language is this: locale cookie -> Accept-Language header -> the path the user navigated to.
Does this mean that when crawlers crawl my website, they will never see the arabic pages because they always get redirected to "/en" when they navigate to "/"? That's if the the crawler puts the default Accept-Language english

acoustic gateBOT
#

Hi @nocturne sage. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Short answer: it depends on how you configure i18n and detection.

From the official docs for automatic locale detection in Next.js (Pages Router), when a user (or crawler) hits “/”, Next.js will try to detect the locale from the Accept-Language header and redirect to a locale-prefixed path for non-default locales. The default locale does not have a prefix in sub-path routing. [Automatic locale; Locale strategies]

Implications for your case:

  • If your default locale is ar and has no prefix (i.e., “/”), and a crawler sends Accept-Language: en, Next.js will redirect “/” to “/en”. In that scenario, the crawler would not see “/” (Arabic) unless it requests “/” without a conflicting Accept-Language or you change detection behavior. [Automatic locale]

Ways to ensure crawlers can see Arabic:

  • Disable automatic locale detection so “/” stays as-is and doesn’t redirect based on Accept-Language. [Automatic locale]
  • Alternatively, implement middleware logic to force your desired behavior (e.g., always redirect “/” to your chosen default locale or respect a cookie). The docs show a middleware approach for prefixing the default locale and note the NEXT_LOCALE cookie can override Accept-Language. [Automatic locale; NEXT_LOCALE cookie]
#

Limitations: The provided sources don’t cover next-intl specifically or crawler behavior beyond the general Accept-Language-based redirects. If you rely on default Next.js detection with sub-path routing and leave it enabled, a crawler advertising English will be redirected to “/en”, not “/”. [Automatic locale]

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@nocturne sage Kapa.ai is still learning and improving, please let me know how I did by reacting below.

nocturne sage
#

@acoustic gate If this is the default behavior, isn't this horrible for SEO?

acoustic gateBOT
#

Let me check the knowledge base for you again. Give me one moment! :books: