:: Example script to redirect IP ::
Basically this tutorial just give a little bit addition or enlightment because maybe you have already knew how to redirect an IP. This literatur just wants to give some picture to you, if you want to have some website on some locations which we known as "Multiple Server". If you do not know yet about "Multiple Server" , you can click here.
Berikut ini adalah script mentahnya belum di modifpikasi dari kami:
[?php
$country = geoip_country_code_by_name($_SERVER["REMOTE_ADDR"]);
if (!(($country == "US") or ($country == "CA") or ($country == "GB") or ($country == "AU"))) { die("Service Unavailable!"); }
?]
The above script is to detect some IP, which base on country ( US, Canada, United Kingdom as an example for this script )
If you use 'Multiple Server", you can use below script, it means you will have some mirror sites .
[?php
$country = geoip_country_code_by_name($_SERVER["REMOTE_ADDR"]);
if ($country== "ID") { echo "<meta http-equiv='refresh' content='0 ;URL=http://www.id.daxa.net/index.php'>"; }
elseif ($country == "US")
{ echo"<meta http-equiv='refresh' content='0 ;URL=http://www.us.daxa.net/index.php'>"; }
?]
You can apply the scripts on main page of your website, for example http://yourdomainname.com/index.php, and put the scripts on the top of page. So if your clients in some country wants to access your web, automatically it will redirected to mirror site according with the IP where your client access the site.
|