20元买的404跳转代码,网站被挪动二级目次,收录显示一般
因为网站调整需要,zblog整站被挪动到二级目次blog,但因为百度谷歌搜索大量的页面,若何让那些页面能准确显示到指定页面呢?阐发网页url改变,只是比之前链接多一个blog的二级目次,好比百度收录的链接"代码如下:
%@ Language=VBScript %
Const BlogHost=""
Dim PageURL,Z404
PageURL=GetUserCurURL
PageURL=Replace(PageURL,BlogHost,"",1,1)
Z404=Split(PageURL,";")(1)
If InStr(PageUrl,"blog") Then
Response.Status=404
Else
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",BlogHost "/blog" Replace(Replace(Z404,BlogHost,""),":80","")
Response.End()
End If
Function GetUserCurURL()
If Request.ServerVariables("
GetUserCurURL = "://"
Else
GetUserCurURL = "http://"
End If
GetUserCurURL = GetUserCurURL Request.ServerVariables("SERVER_NAME")
If (Request.ServerVariables("SERVER_PORT") 80) Then GetUserCurURL = GetUserCurURL ":" Request.ServerVariables("SERVER_PORT")
GetUserCurURL = GetUserCurURL Request.ServerVariables("URL")
If (Request.QueryString "") Then GetUserCurURL = GetUserCurURL "?" Request.QueryString
End Function
我看不懂代码,但代码帮我到达效果,若是你正好有此方面问题,修改此代码元买的与各人分享,希望各人顶起来。