Skip to content

Conversation

chienandalu
Copy link
Contributor

Those redirects can kill how the site is fetched. If a website has its default language different to english and english is available as a secondary one, the crawler bot will be always redirected to the english version. For example: mysite.info/en_US.

The effect of that is that crawlers like the Googlebot-image aren't able to validate the site icon, as they don't use any site subfolder.

This is the relevant part where the redirection should be avoided

# See /3, missing lang in url but user-agent is a bot
elif not url_lang_str and request.env['ir.http'].is_a_bot():
_logger.debug("%r (lang: %r) missing lang in url but user-agent is a bot, continue", path, request_url_code)
request.lang = default_lang

cc @Tecnativa TT48630

Set to draft for the moment to test on customer


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Contributor

robodoo commented Feb 7, 2025

Pull request status dashboard

@C3POdoo C3POdoo requested review from a team, Julien00859, aab-odoo and kebeclibre and removed request for a team February 7, 2025 10:11
@Julien00859
Copy link
Member

Hello @chienandalu thank you for your work.

Set to draft for the moment to test on customer

Have you had the opportunity to test this PR with your customer?

@chienandalu
Copy link
Contributor Author

It avoids the redirection indeed which is needed (tested with user-agent switcher), which is a good signal. Although we're still to receive confirmation of the correct results of the crawling

@victoralmau victoralmau force-pushed the 16.0-fix-googlebot-crawl-lang-redirects branch from 3af65bb to 4f976f9 Compare March 5, 2025 07:55
Those redirects can kill how the site is fetched. If a website has its
default language different to english and english is available as a
secondary one, the crawler bot will be always redirected to the english
version. For example: mysite.info/en_US.

The effect of that is that crawlers like the Googlebot-image aren't able
to validate the site icon, as they don't use any site subfolder.
@victoralmau victoralmau force-pushed the 16.0-fix-googlebot-crawl-lang-redirects branch from 4f976f9 to a3b34b6 Compare August 18, 2025 12:13
@Julien00859
Copy link
Member

Hello @chienandalu, I'm willing to merge this PR once you confirmed me it was working as expected

Although we're still to receive confirmation of the correct results of the crawling

@chienandalu
Copy link
Contributor Author

Looks like after a while it's finally working

@Julien00859
Copy link
Member

Actually @chienandalu looking again at this change. Should "googlebot" be already considered a bot because "bot" in "googlebot"?

@chienandalu
Copy link
Contributor Author

Oh, you're right... I didn't see that it's check agains every string not against the whole list... closing this then. sorry

@chienandalu chienandalu closed this Sep 4, 2025
@Julien00859
Copy link
Member

No worry ;)

@pedrobaeza pedrobaeza deleted the 16.0-fix-googlebot-crawl-lang-redirects branch October 8, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants