<?php
$url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if ($url != "https://site.ru/en/") {
?>
<script>
$.get("https://api.ipdata.co/1.1.1.1?api-key=8455bc1d22ad4b2aafeb4a134608f006d7d662091f169b156932bfdf", function (response) {
if(response.country_code!="RU"){
window.location.replace("/en");
}
}, "jsonp");
</script>
<?php
}
else {
}
?>