Use 301 Redirect As Search Engine Friendly Method

Sometime we are moving our site to new site. It is possible that when we are making a copy to this new website, search engine will assume this new site publish duplicate content. This is not good for search engine optimization. So always use 301 Redirect method to avoid this condition.

There are some way to do 301 Redirect, such as :

  1. Using .htaccess file, write the following code on .htaccess located on your old site.Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
  2. If using Ruby on Rail ( RoR ). Write this script on index page def old_action
    headers["Status"] = “301 Moved Permanently”
    redirect_to “http://www.new-url.com/”
    end
  3. If using perl. Write this script on index page

    $q = new CGI;
    print $q->redirect(”http://www.new-url.com/”);

  4. If using JSP. The code would look like :

    <%
    response.setStatus(301);
    response.setHeader( “Location”, “http://www.new-url.com/” );
    response.setHeader( “Connection”, “close” );
    %>

  5. If using ASP.NET, use this script :

    <script runat=”server”>
    private void Page_Load(object sender, System.EventArgs e)
    {
    Response.Status = “301 Moved Permanently”;
    Response.AddHeader(”Location”,”http://www.new-url.com”);
    }
    </script>

  6. If using ASP, use this script :

    <%@ Language=VBScript %>
    <%
    Response.Status=”301 Moved Permanently”
    Response.AddHeader “Location”,”http://www.new-url.com/”
    %>

  7. If using PHP, use this script :

    <?
    Header( “HTTP/1.1 301 Moved Permanently” );
    Header( “Location: http://www.new-url.com” );
    ?>

  8. If using Cold Fusion, the script is :

    <.cfheader statuscode=”301″ statustext=”Moved permanently”>
    <.cfheader name=”Location” value=”http://www.new-url.com”>


Artikel terkait

One Response to “Use 301 Redirect As Search Engine Friendly Method”

  1. very useful information. thank you !

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.