Changing domain name 301 .htaccess correct way?

Discussion in 'Search Engine Optimization' started by Jarik, Feb 2, 2011.

  1. #1
    Hi to all. I hope I am in the right section.

    I want to do basic change of my domain name, where all files are staying in the old folder. My old domain name is quite new,with no links pointing to it, so i dont care so much about link juice to be transferred, but want to do it right anyway.

    Is this the correct way of doing it?:

    1. point new domain name to the old folder
    2. add to existing .htaccess these lines:
    -RewriteEngine On
    -RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]
    3. verify new domain name in google webmaster

    Thank you
     
    Last edited: Feb 2, 2011
    Jarik, Feb 2, 2011 IP
  2. Jarik

    Jarik Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    also: Will I need to keep my old domain name after it is all redirected? or may I simply let it go?
     
    Jarik, Feb 2, 2011 IP
  3. Tuxxy

    Tuxxy Guest

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Just click on redirects in cpanel and set one up like that, much easier, but yes, 301 redirects are the correct way to go, you'll want to keep the domain even when you've redirected it.
     
    Tuxxy, Feb 2, 2011 IP
  4. Jarik

    Jarik Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    hi Tuxxy. thanx. I am afraid i dont have a function "redirects" on my host, they use something else than regular cpanel. why do I need to keep the old domain? there are no links pointing to it. I want to keep it only until it expires (8months). than drop it. domain names here cost eur30 per year
     
    Jarik, Feb 2, 2011 IP
  5. MartinPrestovic

    MartinPrestovic Peon

    Messages:
    213
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Jarik,

    You almost have it right. Due to the fact that both the old and the new domains will be on the same host you will need to use a slightly different .htaccess rule to prevent the new domain from redirecting to itself otherwise you will end up with an infinite loop:

    1) Point the new domain to the folder.
    2) Add this to the .htaccess file:

    
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.newdomain\.com
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
    
    Code (markup):
    3. Verify new domain in Google.

    As to your later question. You need to keep the old domain purely for the transition period, while you are waiting for Google to index your web site under the new domain and for those pages to rank. Then you won't lose any traffic or link juice (even though it's a little, it still counts).

    HTH
     
    MartinPrestovic, Feb 2, 2011 IP
    Jarik likes this.