• 当前位置:首页 > SEO技巧 > 301重定向怎么做?
  • 301重定向怎么做?

    今天简介一下如何做301重定向,以下是各种情况301重定向的方法:

    IIS服务器实现301重定向方法
      * 打开internet信息服务管理器,在欲重定向的网页或目录上按右键
      * 选择“重定向到URL”
      * 在“重定向到”输入框中输入要跳转到的目标网页的URL地址
      * 选中“资源的永久重定向
      * 最后点击“应用”

    Apache服务器实现301重定向方法
    相比较来说,Apache实现起来要比IIS简单多了。在Apache中,有个很重要的文件.htaccess,通过对它的设置,可以实现很多强大的功能,301重定向只是其中之一。
      redirect permanent /index.php  http://www.611seo.com/(将网页index.php重定向到http://www.611seo.com/)
      通过合理地配置重定向参数中的正则表达式,可以实现更复杂的匹配。了解更多可参考本站Apache手册。

    PHP下的301重定向方法
      <?
      Header( “HTTP/1.1 301 Moved Permanently” ) ;
      Header( “Location: http://www.611seo.com” );
      ?

    ASP下的301重定向方法
      <%@ Language=VBScript %>
      <%
      Response.Status=”301 Moved Permanently”
      Response.AddHeader “Location”,”http://www.611seo.com”
      %>

    ASP .NET下的301重定向
      <script runat=”server”>
      private void Page_Load(object sender, System.EventArgs e)
      {
      Response.Status = “301 Moved Permanently”;
      Response.AddHeader (“Location”,”http://www.611seo.com”);
      }
      </script>

    ColdFusion下的301重定向方法
      <.cfheader statuscode=”301″ statustext=”Moved permanently”>
      <.cfheader name=”Location” value=”http://www.611seo.com”> 旧域名重定向到新域名
      创建一个.htaccess文件,并将下面提供的代码写入文件内,它可以确保旧域名所有的目录或者网页正确的跳转到新域名内。
      记住.htaccess文件一定要放在旧网站的根目录下,并且新网站要和旧网站保持相同的目录结构及网页文件
      Options +FollowSymLinks
      RewriteEngine on
      RewriteRule (.*) http://www.611seo.com/index.php$1 [R=301,L]
    .htaccess文件只有在使用安装有Mod Rewrite模块的Apache作为WEB服务器的Linux主机上才能起作用。


    阅读“ 301重定向怎么做?”的人还对以下文章感兴趣!

    评论这篇文章

    Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.