经典的ASP版301跳转推荐

在点石论坛一位叫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
%>

简单的应用如下

  1. 单独的两个玉米之间的跳转

    <%
    Response.Status="301 Moved Permanently"
    Response.AddHeader "Location",http://www.seo56.net
    Response.End
    %>

  2.   多玉米之间的跳转

    <%
    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.cnwww.seo56.net,实现着cn跳转主玉米的301跳转。



本文标题: 《经典的ASP版301跳转推荐》
原创文章如转载,请注明:转载自网站优化 [ http://www.seo56.com/ ]
[本日志由 yafan99 于 2008-11-11 03:29 PM 编辑]
文章来自: 南京SEO
热门标签: 301 ASP
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.