« 变态验证码欣赏我有个办法,任何asp页面变成全静态页面 »

网站改版,更换了url之后必须要做的事情:301重定向

前一久,把两个我网站生成了全静态页面,www.kmfxx.cn  www.zhaoshang100.com  每个站百度收录分别为:6.9w和3w,改版后原来的页面还是能链接到新的静态页面上,但是忘记了做301重定向,前天一个站被百度k了,才发现返回值都是302,马上改了回来,原理如下:

比如原来页面时:www.kmfxx.cn/more/?10000.html 新页面是:www.kmfxx.cn/html/10000.html ,我当时只做了 response.redirect,没有估计到301问题,原来写法为:
<%
Dim rsGetURL 'database Recordset Variable
Dim keyno'Holds the database ID No for a web site
Dim strURL 'Holds the URL
Dim intSiteHits'Holds the number of click through hits the site has recieved
keyno=request.QueryString("keyno")
If keyno="" Then
server_v40=Request.ServerVariables("QUERY_STRING")
keyno=replace(replace(server_v40,"/",""),".html","")
End If
newurl="../html/"&keyno&".html"
Response.redirect newurl
%>
后来的用了301重定向的页面:
<%
Dim rsGetURL 'database Recordset Variable
Dim keyno'Holds the database ID No for a web site
Dim strURL 'Holds the URL
Dim intSiteHits'Holds the number of click through hits the site has recieved
Response.Status = "301 Moved Permanently"
keyno=request.QueryString("keyno")
If keyno="" Then
server_v40=Request.ServerVariables("QUERY_STRING")
keyno=replace(replace(server_v40,"/",""),".html","")
End If

newurl="../html/"&keyno&".html"
Response.AddHeader "Location", newurl
%>
 

两个页面对用户的结果是一样,但是搜索引擎判断是大相径庭,301定向的话 可以把原来页面的权重转移过来,而直接跳转识别为302的话就重新开始,弄不好就会被k。

注:本文发自云南电子商务研究站(http://www.xiongmaotou.com),转载请附带本说明,谢谢

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。