1

There are a couple of questions about this topic here, but I couldn't find an answer that is specific to my question.

So, I'm building a website which currently only supports one language, but I want to make it bi-lingual, meaning every page will be available in two languages. Each page will have the same contents, only translated in two languages. What I want to do is detect the language of the browser in my PHP-script and serve the different versions based on that (there will probably be a button to switch the language as well). However, with that approach, both versions of the same page would share one URL (e.g. example.com/about would show either versions of the page, depending on the user's browser language and/or a session/cookie). Is that bad for SEO-purposes? And are there any other downsides that I'm not aware of?

I'm asking this as given the way the project is laid out, it would be not that easy to make the second version of each page available over a different URL (e.g. example.com/en/about or en.example.com/about). If the approach above is not advisable, would it be a viable alternative to determine the language by a URL parameter, e.g. example.com/about?l=en (where the script defaults to my local language if no parameter is passed)?

1 Answer 1

3

What I want to do is detect the language of the browser in my PHP-script and serve the different versions based on that (there will probably be a button to switch the language as well). However, with that approach, both versions of the same page would share one URL (e.g. example.com/about would show either versions of the page, depending on the user's browser language and/or a session/cookie). Is that bad for SEO-purposes?

The problem here is that search engine crawlers use basic settings and no cookies by default. For example, if you have example.com/about and it displays english text if a cookie and browser language are set to a certain value and it displays french text if nothing is set then search engine crawlers in this case will only be able to scan french text. This means the english text will never be indexed.

If you really want to know what actual settings crawlers use, you can use a PHP script to detect the language, cookies, and IP address the search engine uses.

would it be a viable alternative to determine the language by a URL parameter, e.g. example.com/about?l=en (where the script defaults to my local language if no parameter is passed)?

This setup is better than your first idea since the search engine crawler can index each and every page without a special setup (such as having certain cookies or language set).

What I would suggest is using mod_rewrite module if you have apache installed to make friendly URLs such as these:

http://example.com/en/about
http://example.com/fr/about
http://example.com/it/about

Here's more info on how to start using the module:

https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

4
  • Thanks for the suggestions! So if I'm understanding your answer correctly, my original plan would result in Google indexing the site only in the default language, ignoring the english version? Are there any other downsides to that? Because this might actually be what I want, as the english version doesn't need to be indexed anyway ...
    – MoritzLost
    Aug 28, 2015 at 16:00
  • 1
    Eh? Why would you not want the English content indexed? If you're providing English content to your users, then it's probably worth having that indexed so they can find it. Aug 28, 2015 at 16:40
  • Gin-San that's right and I agree with Andrew. It's better to have all public pages in all languages on your site indexed Aug 28, 2015 at 18:07
  • Well the target audience is German anyway, I'm building this website for friends and they asked for an english version, to be honest I have no idea why °v° But thanks, I guess I'll build it like you suggested, thanks!
    – MoritzLost
    Aug 28, 2015 at 19:51

Your Answer

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

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