经典的ASP版301跳转推荐
作者:yafan99 日期:2008-10-06
在点石论坛一位叫microwind的朋友公布的,刚刚用了很好用,记录下来备用:
<%
if request.ServerVariables("HTTP_HOST")="domain1.com" or request.ServerVariables("HTTP_HOST")="www.domain1.com" then
if Request.ServerVariables("QUERY_STRING")<>"" then p="?"
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.domain2.com"&Request.ServerVariables("SCRIPT_NAME")&p&Request.ServerVariables("QUERY_STRING")
Response.End
end if
%>
简单的应用如下:
- 单独的两个玉米之间的跳转
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",http://www.seo56.net
Response.End
%> - 多玉米之间的跳转
<%
if request.ServerVariables("HTTP_HOST")="seo56.cn" or request.ServerVariables("HTTP_HOST")="www.seo56.cn" then
if Request.ServerVariables("QUERY_STRING")<>"" then p="?"
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.seo56.net"&Request.ServerVariables("SCRIPT_NAME")&p&Request.ServerVariables("QUERY_STRING")
Response.End
end if
%>红色部分可以重复多个玉米,以实现多玉米跳转到一个主玉米的301 。
本站就使用第二种方式绑定www.seo56.cn跟www.seo56.net,实现着cn跳转主玉米的301跳转。
上一篇
下一篇

文章来自:
Tags: