How to do a redirect to the Russian and English version of the site?

Hosting two directories: EN and en, for Russian and English users, respectively. How to make so that for the first time, Russian, Belarusian,Ukrainian and Kazakh ip addresses threw on the EN directory, and with others - in en?
July 2nd 19 at 18:24
5 answers
July 2nd 19 at 18:26
Why the IP?! You can also learn what language is used at the user and have to do a redirect. It's misery to do on IP. Here's the solution
no. The first of the countries that uses the Cyrillic alphabet. You can easily understand what they will receive en_us. But if someone from the Ukrainian or Russian he uses the English version, then that's his problem and he can switch to Russian. But it is wrong to do IP! They can change! You can certainly Google drive "ip base countries" and from there on the mask to check, but, damn! IT'S A BAD METHOD. - Mohamed.Funk commented on July 2nd 19 at 18:29
July 2nd 19 at 18:28
to put the base ip addresses (or with third-party service, but it's very long) and depending on — where it is necessary to throw
July 2nd 19 at 18:30
Among other things, the browser usually gives a set of preferred user languages, almost ready solution + list "Russian speakers" of languages is there. But if you really want it by IP and/or browser is not sent a set of preferred languages (*I would in this case just threw on EN), you can use a ready-made solution for PHP.
July 2nd 19 at 18:32
The correct solution is to use the information from the header about the used language.
If you are unable to identify the language according to browser, you should rely on the definition of through an Ip address. Just lean on the country code. If not found, then always open the English version.
July 2nd 19 at 18:34
You can try to determine the location via geo-targeting

Find more questions by tags ProgrammingWeb DevelopmentPHP