技术教程
当前位置:首页 > 技术教程

多个绑定多域名的PHP代码

( 更新:11-16   加入收藏)
这是一段很有用的代码,和绑定多域名的ASP代码类似,如果你只有一个PHP空间,而你又想放置多个多个站点,下面这些代码可以帮到你。
第一个:

if($HTTP_HOST=="www.baidu.com"){
Header("Location: moon.htm");
}
elseif($HTTP_HOST=="www.baidu.info"){
Header("Location: long.htm");
}
else{
Header("Location: other.htm");
}


第二个:

if($HTTP_HOST=="www.baidu.com"){
require "moon.htm";
}
elseif($HTTP_HOST=="www.baidu.info"){
require "long.htm";
}
else{
require "other.htm";
}

相关阅读