1

We are launching a big international web site, that has local web sites on other domains.

We are planning to configure the web site to behave in the following manner:

Of a user with German (de) Accept-Language header visits example.com, he is automatically redirected to example.de.

If on example.de he selects to go to example.com, the specific "no redirect in future" cookie is added. Now, when he visits example.com, he is no longer redirected.

Will this "initial redirect" behavior have any negative implication of website's reputation in search engines?

2

2 Answers 2

2

I will keep it simple and only talk about the language. The best would be to create one subfolder for english speaking readers, let's say: /en/ and one subfolder for german speaking readers, let's say: /de/

Then, your htaccess will be something like:

RewriteEngine On
#exclude robots.txt 
RewriteCond %{REQUEST_FILENAME} robots.txt
RewriteRule ^ - [L]

RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP:Accept-Language} de [NC]
RewriteRule ^$ https://yourdomain.com/de/ [L,R=301]
RewriteRule ^$ https://yourdomain.com/en/ [L,R=301]

Then, when googlebot will visit your root domain it will be redirected to yourdomain.com/en/ because its accept-language is equal to "en". On this webpage, a link pointing to yourdomain.com/de/ may help googlebot to visit your german pages.

if you want to see a real life example. Type in google something like "HP laptop" and you'll see the first url will point to a local subfolder /de-de/ if you are located in germany. The microsoft and IBM websites have this logic in place.

By the htaccess directives will redirect the root domain to /en/ if the accept-language is equal to "fr" "es" or anything else than de. You can add additional directives to redirect to other subfolders in different languages.

Doing so, you sacrifice the root domain but you don't need cookies at all and whatever the language of the visitor, the English or German webpages can be displayed without problems. I have checked this logic and it works well with google and bing.

Don't forget to exclude anything that should be located in the website's root like robots.txt

Update: I have removed the ^ in front of de because de-DE can be located anywhere in the list of language. For example, someone may put Japanese as language of choice and then German in second place and it would give: jp-JP,de-DE; So, in this case, it has to match if the "accept-language" script contains de anywhere.

0

Googlebot does not use or store cookies so you have no problem there. However, if the sites have similar content written in different languages you should use the rel=alternate and hreflang values as described in the following article:

https://support.google.com/webmasters/answer/189077?hl=en

You can also find a few more tips and best practices here: 300, 302, 303 or 307 redirect for international site?

1
  • "Googlebot does not use or store cookies so you have no problem there." - The cookie would only be relevant anyway if the user-agent sends a "German (de) Accept-Language header" and Googlebot doesn't send an Accept-Language header to begin with.
    – MrWhite
    Commented Oct 22, 2021 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.