On my web site I have to do automatic redirection depending on the location from which a user visits the site. For example, when a user visits the home page from England it opens www.mysite.com, if a visitor from France it opens www.mysite.com/fr. In what way is best to make a redirect to a specific page. Does anyone have any example of how to do this ?
Best regards.
-
☆ A M B ☆
- 24,524 Posts
How is this to be determined? By IP address? By browser language preference?
It is determined by browser language preference.
-
☆ A M B ☆
- 24,524 Posts
Then you need a plugin to get that value and redirect accordingly. Here is a plugin that does that with contexts for each language
https://gist.github.com/gadamiak/3812853
If you don't want to use the whole plugin, you should be able to pick out the code you do want.