0

I am working on a personal website and I am trying to implement a system that redirects a user before he reaches the website to the same version of the website but in the user's appropriate language.

I don't have shell access, I only have access to DirectAdmin.. Is this possible?

Thanks in advance.

Lennert
  • 21
  • 5
  • title says location, text says language - not the same thing so which do you want ? –  Mar 05 '15 at 19:30
  • This [answer](http://stackoverflow.com/a/3770616/4633718) might help you, a simple and clean solution. – Arikado Mar 05 '15 at 19:31
  • You can use PHP's GeoIP extension to locate a user from their IP address, but this isn't always reliable. Alternatively, you could check the `Accept-Language:` header and see which language they'd prefer. –  Mar 05 '15 at 19:31

1 Answers1

1

You can manage to solve the problem with browser language. Put in header:

    var language = window.navigator.userLanguage || window.navigator.language;

    if (language != "pt-pt") {
        window.location.href = "www.yoursite.en";
    }