My website is localized in three languages: en, de, fr. The language versions are appended to the URL as folders (e.g. website.com/en/, website.com/de/, website.com/en/contact/, etc). The root page (website.com) has a server-side PHP redirect (302) based on HTTP_ACCEPT_LANGUAGE
to one of these language versions, with a fallback to /en/.
hreflang
attributes are set correctly, the root page has no hreflang or canonical tags because it does a header redirect before it renders any HTML.
Everything works as expected, just the google index seems to index the root page instead of /en/, because it sees it as a duplicate of /en/, as the google bot with an English user agent is always redirected to /en/. Google prefers the root page (with the redirect) instead of /en/ and therefore excludes /en/ from the index. Is there something I can do to make it index /en/ instead of /?
The pages I want in the Google index are:
- /en/
- /de/
- /fr/
The root page should not be in the index, as it redirects to the correct language for the user, but Google thinks it's the same as /en/. Right now English Google results show the root page.