<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<?php
$url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if ($url != "https://site.ru/en/") {
?>
<script>
$.get("https://ipinfo.io", function(response) {
if(response.country != "RU") {
document.location.href="/en";
}
else {
}
}, "jsonp");
</script>
<?php
}
else {
}
?>