Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!