Asp源码:
<%
host=lcase(request.servervariables("HTTP_HOST"))
select CASE host
CASE "test1. y1web.com"
response.redirect "test1/index.asp"
CASE "www.y1web.com"
response.redirect "index.html"
END select
%>
Php源码:
<?php
switch ($_SERVER["HTTP_HOST"])
{
case "www.test1.com":
header("location:index.htm");
break;
case "www.test2.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存放在根目录,修改相应的域名和文件目录并设置优先级为最高。然后通过访问域名就可以跳转到相应的子网站了。