SEO

Date: 2010-12-30 18:55:41Written By 郑州seo

zblog用程序代码做301重定向的方法

  • 标签: 301重定向的方法, 点击 Counts:933 次

自从那次看到某人说301重定向可以把不带www的权重集中到带www的上面,我就打算做301重定向,因为我也是发现自己网站的权重有分散,所以决定做,我的四个站都是用zblog的,所以就上网搜索zblog做301重定向的方法,可是我搜了两天还是没有解决,让我感触最深的是,网络上的资料千篇一律,全部是转载当做自己的原创,只有第一个写出这个方法的是原创,让我失望的是,提到asp程序做301重定向的方法时,只是给出一段破代码,然后啥都没有说,即使有提到zblog程序时,也是直接给出代码,没有什么具体的方法,这个让我们广大的菜鸟怎么做,细说一下不行吗?无语...然后又经历了n次折腾,终于找到具体的方法了,过程不再说了,直接给出答案。
<!-- #include file="c_option.asp" -->
<!-- #include file="function/c_function.asp" -->
<!-- #include file="function/c_function_md5.asp" -->
<!-- #include file="function/c_system_lib.asp" -->
<!-- #include file="function/c_system_base.asp" -->
<!-- #include file="function/c_system_event.asp" -->
<!-- #include file="function/c_system_plugin.asp" -->
<!-- #include file="plugin/p_config.asp" -->
<%

if request.ServerVariables("SERVER_NAME")="zaoren.org" then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",
http://www.zaoren.org
Response.End
end if

If (InStr(LCase(Request.ServerVariables("HTTP_ACCEPT")),"text/vnd.wap.wml") > 0) And (InStr(LCase(Request.ServerVariables("HTTP_ACCEPT")),"text/html") = 0)  Then Response.Redirect "wap.asp"
这段代码在是zblog程序的default.asp文件,在我们根目录下面,然后找到它,把上面两个表情之间的代码复制到你的里面,位置已经很清楚了,看上面的代码,记住把代码中的网址换成你自己的,其它不要改动。
做完这个,记住一点要进行301重定向检测,当时我用了网络上的烂方法,结果检测出返回302,不是永久重定向,而是暂时重定向,幸亏我检测了,所以加完后,一定要检测一下!

转载注明来源:http://www.zaoren.org 郑州seo