22.jpg

 

 

------ASP------
<%
host=lcase(request.servervariables("HTTP_HOST"))
Select CASE host
CASE "XXX.cn"
response.redirect "XXX.htm"
CASE "www.XXX.cn"
response.redirect "XXX/"
CASE "oa.XXX.cn"
response.redirect "XXX/"
CASE "admin.XXX.cn"
response.redirect "XXX/"
END Select
%>
新建index.asp文件。


------ASP.NET------
<script type="text/C#" runat="server">
void Page_Load(object sender, EventArgs e)
{
string url = Page.Request.ServerVariables["HTTP_HOST"];
switch (url)
{
case "bbs.abc.com":
Server.Transfer("bbs/");
break;
case "t.abc.com":
Server.Transfer("t/");
break;
default:
Server.Transfer("default.aspx");
break;
}
}
新建index.aspx文件。


------HTML------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<BODY>
<Meta name="Robots" Content="All">
<script language="JavaScript">
if(location.hostname=="XXX.cn")
location="/XXX";
if(location.hostname=="www.XXX.cn")
location="/XXX";
if(location.hostname=="oa.XXX.cn")
location="/XXX";
if(location.hostname=="admin.XXX.cn")
location="/XXX";
</script>
</BODY>
</HTML>
新建index.html文件。