Step #1 - Get IP Address
Step one is easy enough
$_SERVER['REMOTE_ADDR']
Actually, this may not be the most accurate method. But this is covered in more detail in this thread
Step #2 - Get Region from IP
The only way to associate an IP with a region, is to use a third-party service. For example, ipinfo.io.
$ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
echo $details->region; // E.g. england.
Step #3 - Redirect Page
Finally, you can then redirect the user using the above result.
switch ($region) {
case 'england':
header("Location: https://somewhere/england",TRUE,301);
exit;
break;
case 'spain':
header("Location: https://somewhere/spain",TRUE,301);
exit;
break;
case 'germany':
header("Location: https://somewhere/germany",TRUE,301);
exit;
break;
default:
header("Location: https://somewhere/england",TRUE,301);
exit;
break;
}
}