首页 > 其他 > 详细

关于301错误跳转

时间:2014-12-19 11:53:37      阅读:268      评论:0      收藏:0      [点我收藏+]

301错误主要是域名更换后,搜索引擎还在使用你原有的域名地址访问你的网站,如果搜索引擎爬取的时候得到的是一个301错误,那么搜索引擎就知道你已经更换了域名,下次就会使用新域名来索引你的网站,当然你要告诉搜索引擎你的新域名是什么

【引用百度拉】

bubuko.com,布布扣
//需要在webconfig配置
 <system.webServer>
    <handlers>
      <add name="301html" path="*.html" verb="*" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" preCondition="integratedMode" />
   
    </handlers> </system.webServer>

//修改Global.asax文件

  void Application_BeginRequest(object sender, EventArgs e)
    {
        if (HttpContext.Current.Request.RawUrl.Contains("123.html"))//旧页面
        {
            Response.StatusCode = 301;
            Response.Redirect("http://www.baidu.com");//跳转地址
            Response.End();
        }
    }
    
View Code

 

关于301错误跳转

原文:http://www.cnblogs.com/LoveTX/p/4173419.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!