Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

176
Visualizações
Javascript location.href redirection after a timeout: do search engine crawlers consider it as a redirect?

Let's say I have example.com/fr/article123 (in french). If the browser-language is not french, I do a redirection to example.com/article123 (in english) with:

<script>
setTimeout(function() { location.href = "example.com/article123" }, 100);
</script>

I know that nowadays search engine crawlers execute JavaScript up to a few seconds.

Question: as of 2021, will example.com/fr/article123 be indexed by GoogleBot on its own, or be considered a 302-redirection of example.com/article123 and therefore not be indexed?

If it is the latter, does this mean that nowadays "automatic redirection to browser language", even when done carefully (see note after), either by PHP or JavaScript, is totally obsolete? Is there no way to do it anymore, if we want to be search-engine-friendly?

Notes:

  • I only do this under certain conditions: only once with cookies (an english-language user may want to visit the french website after all, so I only try to redirect them once), only if cookies are accepted by browser, etc. I added these conditions carefully, and my tests show it's usually good for user experience.

  • I first did the redirection with PHP header('Location: ...'); but then I noticed That GoogleSearchConsole and AhrefsSiteAuditTool considered that example.com/fr/article123 is a 302 redirection and therefore not indexed, and that example.com/article123 is its canonical URL (bypassing my <link rel="canonical" href="example.com/fr/article123">), conclusion: it's bad. More info about the PHP solution here: Search engine crawlers get redirected to English pages (and thus avoid other languages' pages) with a multilingual website.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda