J
J
jaffrey2016-11-08 20:10:54
PHP
jaffrey, 2016-11-08 20:10:54

How to make a redirect to the Russian and English versions of the site?

There are two directories on the hosting: ru and en, for Russian-speaking and English-speaking users, respectively. How to make it so that when entering from Russian, Belarusian, Ukrainian and Kazakh ip addresses, the directory is thrown to ru, and from the rest - to en?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Archakov Dennis, 2016-11-08
@archakov06

Why by IP?! You can also find out what language the user is using and already do a redirect. This squalor to do on IP. Here is your solution

R
romy4, 2016-11-08
@romy4

put a database of ip addresses (or from a third-party service, but this is very long) and, depending on - transfer where necessary

E
Eugene Volf, 2016-11-08
@Wolfnsex

Among other things, the browser itself usually gives out a set of languages ​​​​preferred by the user, an almost ready-made solution + a list of "Russian-speaking" languages ​​\u200b\u200bis here . But if you really want it by IP and / or the browser did not send a set of preferred languages ​​\u200b\u200b(* in this case I would just transfer it to EN), then you can use a ready-made solution for PHP .

P
Philipp, 2016-11-08
@zoonman

The correct solution is to use the information from the headers about the language being used.
If it is not possible to determine the language from the data from the browser, you should rely on the definition through the Ip address . Just rely on the country code. If not found, then always open the English version.

F
Formula_1, 2017-03-16
@Formula_1

You can try to determine the location through geotargeting

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question