深圳网站建设-深圳做网站

域名更换后404跳转代码实现自动跳转

来源:深圳网站建设 发布时间:11/22/2014 9:07:17 AM 浏览次数:

原问:
假设以前有个为:http://www.abc.com/
现在要更换一个新的:http://www.123.com/  
怎样才能让http://www.abc.com/自动跳转到http://www.123.com/
我说的跳转是在http://www.abc.com/带有参数的时候,比如
http://www.abc.com/01/1.html 自动跳转到 http://www.123.com/01/1.html
 
如果定义一个404错误,这个代码怎么写。  
感谢 etangren 
404.asp 你就这样写 

CODE:[Copy to clipboard]<%
dim url
Private Function GetUrl()
Dim ScriptAddress, M_ItemUrl, M_item
ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME")) '取得当前地址
M_ItemUrl = ""
If (Request.QueryString <> "") Then
ScriptAddress = ScriptAddress & "?"
For Each M_item In Request.QueryString
If InStr(page,M_Item)=0 Then
M_ItemUrl = M_ItemUrl & M_Item &"="& Server.URLEncode(Request.QueryString(""&M_Item&"")) &  
"&"
End If
Next
end if
GetUrl = ScriptAddress & M_ItemUrl
End Function
%> 
<%Response.Redirect "http://www.abc.com/"&Url&""%> 跳转的