首页 >> 主机租用解答

怎样让虚拟主机支持开设子网站?

发布时间:2012-6-13 10:55:12 被阅览数:18827次 来源:虚拟主机支持开设子网站

Asp源码:
 <%
 host=lcase(request.servervariables("HTTP_HOST"))
 select CASE host
 CASE "test1.5778.com"
 response.redirect "test1/index.asp"
 CASE www.abcde.cn
 response.redirect "index.html"
 END select
 %>

Php源码:
 <?php
 switch ($_SERVER["HTTP_HOST"])
 {
 case www.0755idc.com:
 header("location:index.htm");
 break;
 case www.0755idc.com:
 header("location:test2/index.htm");
 break;
 case "bbs.test3.com":
 header("location:bbs/");
 break;
 case "taobao.test3.com":
 header("location:taobao/");
 break;
 case "v.test3.com":
 header("location:v/");
 break;
 }
 ?>


将以上代码保存为index.asp或者是index.php存放在根目录,修改相应的域名和文件目录并设置优先级为最高。然后通过访问域名就可以跳转到相应的子网站了。

  • 电话咨询

  • 05925908028