Skip to content

Instantly share code, notes, and snippets.

@bwhli
Last active August 16, 2021 03:28
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwhli/5d744eb0400edc333c0f to your computer and use it in GitHub Desktop.
Save bwhli/5d744eb0400edc333c0f to your computer and use it in GitHub Desktop.
<?php
$country_code = $_SERVER ["HTTP_CF_IPCOUNTRY"];
if ($country_code=="US") {
$link = 'http://us.domain.com';
}
else if ($country_code=="GB") {
$link = 'http://uk.domain.com';
}
else if ($country_code=="HK") {
$link = 'http://hk.domain.com';
}
header("location:$link");
exit;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment