View Mode: Normal | Article List

ASP/PHP实现主机头多域名转向的方法

[ 2004-09-08 18:24:22 | Author: zhenhua ]
ASP:
1.使用CASE语句,缺点:同一域名即@和www需要两次循环,代码显重复
<%
host=lcase(request.servervariables("HTTP_HOST"))
select CASE host
CASE "www.abc.com"
 response.redirect "index.htm"
CASE "abc.com"
 response.redirect "index.htm"

CASE ELSE
 response.redirect "other.htm"
END select
%>
--------------------------
<%if instr(Request.ServerVariables
("SERVER_NAME"),"kekexi.com")>0 then
response.redirect "index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"4668.com")>0 then
response.redirect "x/index.asp"
...

Read More...