由于网站调整需要,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
%>
我看不懂代码,但代码帮我达到效果,如果你正好有此方面问题,修改此代码元买的与大家分享,希望大家顶起来。
评论列表