Asp实现域名转向功能[转]

by 曾经沧海
498 阅读

根据不同域名链接到不用目录文件的asp代码
第一个 
<%if Request.ServerVariables("SERVER_NAME")="123.com" then
response.redirect "bbs"
else
response.redirect "index1.htm"
end if%>

第二个
<%
select case request.servervariables("http_host")
case "www.123.com" '1
Server.Transfer("along.htm")
case "www.456.net.ru" '2
Server.Transfer("net.htm")
case "www.567.com.ru" '3
Server.Transfer("null.htm")
…… 继续添加 ……
end select
%>

第三个
<%if instr(Request.ServerVariables
("SERVER_NAME"),"123.com")>0 then
response.redirect "index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"456.com")>0 then
response.redirect "x/index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"789.com")>0 then
response.redirect "index3.asp"
end if
end if
end if%>

第四个
<%if Request.ServerVariables("SERVER_NAME")="www.123.com" then
response.redirect "main1.asp"
else if Request.ServerVariables("SERVER_NAME")="123.com" then
response.redirect "main1.asp"
else if Request.ServerVariables("SERVER_NAME")="www.456.com" then
response.redirect "/web/index.asp"
else if Request.ServerVariables("SERVER_NAME")="456.com" then
response.redirect "/web/index.asp"
end if
end if
end if
end if%>

第五个
<% 
'取得HTTP输入的值并付值到HTOST中
host=lcase(request.servervariables("HTTP_HOST"))
'开始条件跳转
SELECT CASE host
' 如果HOST的值是www.iswind.net就选择事件case"www.iswind.net"的命令
CASE "www.abc.net"
' Below is the redirect command
response.redirect "web/"
CASE "www.efd.com"
response.redirect "web1/"
'We use CASE ELSE to fix any other requests
CASE ELSE
response.redirect "web1/"
END SELECT 
%>

发表评论