asp 域名跳转

域名跳转 将xxx.cn定向到www.xxx.com

dim querys,Urls
Urls = "http://www.xxx.com"&Request.ServerVariables("PATH_INFO")
querys = Request.ServerVariables("QUERY_STRING") 
If querys <>"" Then Urls=Urls&"?"& querys 
if Request.ServerVariables("HTTP_HOST")="xxx.cn" or Request.ServerVariables("HTTP_HOST")="www.xxx.cn" then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",Urls
Response.End
end if
例子 http://www.xxx.com/info.asp?id=1

Request.ServerVariables("PATH_INFO") 获取的是/info.asp
Request.ServerVariables("QUERY_STRING") 获取的是id=1
Request.ServerVariables("HTTP_HOST") 获取的是 www.xxx.com

连起来就是完整的url地址。

ASP跳转主要用到了下面两个东东
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",Urls

Urls是跳转的地址,动态的变量

做下笔记,同时分享下。

posted @ 2014-08-19 16:47  leisir  阅读(667)  评论(0编辑  收藏  举报