Using php to control many domains withing one web host
April 12th, 2008 — admincan build many web sites, with one web host, one site with one different domain, just using php, it can make you very happy, save your money.
$arrays=array(
’www.money.com’=>’money/index.html’,
’www.insurance.com’=>’insurance/index.html’,
’www.car.com’=>’car/index.html’,
’www.travel.com’=>’travel/index.html’,
’127.0.0.1’=>’forum/index.php’,
);
$url = $arrays[$_SERVER[’HTTP_HOST’]];
Header(”Location: $url”);
?>
We also can use the following codes:
$domain_net=”money.com”;
$dot_net_url=”forum/”;
$dot_com_url=”car”;
if(($HTTP_HOST==”$domain_net”)or($HTTP_HOST==”www.$domain_net”))
{
Header(”Location: $dot_net_url”);
}
else
{
Header(”Location: $dot_com_url”);
}
?>