Any tips on how to show a geoip warning page when someone visits a site without using htaccess? I don't want to use htaccess because of server load on high traffic sites.
Thanks
Thanks

<?
$validCountries = array('US', 'CA', '...');
$countryCode = geoip_country_code_by_name($_SERVER['REMOTE_ADDR']);
if(!in_array($countryCode, $validCountries)) {
header('Location: http://www.someplace.com/country_not_aloud');
exit();
}
?>

<?php
$lang = ($_SERVER['HTTP_ACCEPT_LANGUAGE']);
if(preg_match("zh", $lang)) {
header("location: http://www.domain.com/china.html");
} else {
header("location: http://domain.com/");
}
?>

Comment