Greetings. I would like to understand how to determine the country of the user (preferably in PHP) on my site, and then send it to the appropriate section or sub-domain of the site (or another server), it is necessary for example that a user from Kazakhstan visiting the site .ru (which is located in Russia and has a standard Russian language) was automatically redirected to another sub-domain, for example, https://kz.site.ru , which has a different interface and also the Kazakh language. Thank! Regards, Developer!
- take somewhere ip list and determine from them .... for example programva.com/ru/ip-adresa-evropa-rosija-mir ..... Kazakhstan: programva.com/ru/ip-adresa-evropa- rosija-mir / KZ-KAZ-Kazakhstan - Alexey Shimansky
|
1 answer
I use Tabgeo (unfortunately the project is dead, but I think you will understand the point).
Download from here both files https://github.com/dostelon/TabGeo/tree/master/src/TabGeo and put, for example, them in the tabgeo folder
Determine the country code
include('tabgeo/country.php'); $ip = $_SERVER['REMOTE_ADDR']; $lang = country($ip); $lang=strtolower($lang); Redirect
if ($lang=='kz') { header("Location: http://kz.site.ru/"); } - And the Crimea in this library is ours? - Geri4
- I think that there is no and it is unlikely to be - Alexey Shatrov
|