How to do 301 redirect

Discussion in 'Search Engine Optimization' started by invisible, Jul 25, 2008.

  1. #1
    I am leaving the old domain and making the site on new domain. I'd like to do 301 redirect, can anyone help me?
     
    invisible, Jul 25, 2008 IP
  2. priyakochin

    priyakochin Banned

    Messages:
    4,740
    Likes Received:
    138
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use this code in <head> :

    <META http-equiv="refresh" content="2;URL=http://www.your-new-site.com">

    or use the redirection in control panel.
     
    priyakochin, Jul 25, 2008 IP
  3. Stevo30

    Stevo30 Peon

    Messages:
    25
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Heres a few options

    IIS Redirect
    In internet services manager, right click on the file or folder you wish to redirect
    Select the radio titled "a redirection to a URL".
    Enter the redirection page
    Check "The exact url entered above" and the "A permanent redirection for this resource"
    Click on 'Apply'
    ColdFusion Redirect
    <.cfheader statuscode="301" statustext="Moved permanently">
    <.cfheader name="Location" value="http://www.new-url.com">


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


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


    ASP .NET Redirect
    <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>


    JSP (Java) Redirect
    <%
    response.setStatus(301);
    response.setHeader( "Location", "http://www.new-url.com/" );
    response.setHeader( "Connection", "close" );
    %>


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


    Ruby on Rails Redirect
    def old_action
    headers["Status"] = "301 Moved Permanently"
    redirect_to "http://www.new-url.com/"
    end
     
    Stevo30, Jul 25, 2008 IP
    jitendraag likes this.
  4. gtwlabs

    gtwlabs Peon

    Messages:
    216
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi Friend

    I've some below info about 301 Redirection guide,

    1. Locate or create a .htaccess file on your server. Your .htaccess file gives search engine robots instructions on security and redirects.

    2. If you don't have an .htaccess file on your server, you can easily create one using a text file. Name it ".htaccess"

    3. If there is already an .htaccess file scroll down past the code that is already there and begin your new redirect instructions.

    4. Put in your redirect information, which should look like this:

    redirect 301 /directory/file.html http://www.domainame.com/directory/file.html

    *Note: The first part "/directory/file.html" is the location of the file being moved and the second part "http://www.domainame.com/directory/file.html" is where the file is being moved.

    5. Upload the file to your server.

    (Source: internetbasedmoms.com/seo/301-redirect.html)

    Thanks
    Gtwlabs
     
    gtwlabs, Jul 25, 2008 IP