博主呓语:

php实现域名跳转

Posted by 破冰 on 2012-3-7 0:53 Wednesday
<?php
$domain_net="xshell.net";
$dot_net_url="http://www.xshell.net";
$dot_com_url="http://www.xshell.net";
if(($HTTP_HOST=="$domain_net")or($HTTP_HOST=="www.$domain_net"))
{
Header("Location: $dot_net_url");
}
else
{
Header("Location: $dot_com_url");
}

?>

保存为index.php即可,输入域名为xshell.net访问时,自动跳转到www.xshell.net

发表评论: