Changed Website URL - How To Set Up Redirect For Each Page (Including Homepage)?

Discussion in 'Site & Server Administration' started by bad_bob00, Jan 1, 2010.

  1. #1
    Hi,

    I've got an old website (lets say www.123.com) and I want to move it to my new website (www.456.com).

    The old website has about 10 pages, and I want to keep the search engine ranking that it has.

    What I've done is upload a .htaccess file to 123.com with the following lines:
    It seems to work as when I go to www.123.com/index.html it takes me to www.456.com but if I go to www.123.com (without the index extension) it doesn't redirect me, I'm not sure why.

    How can I set it up to redirect from my homepage to the new homepage?


    Thanks for any help
     
    Last edited: Jan 1, 2010
    bad_bob00, Jan 1, 2010 IP
  2. chadsmith

    chadsmith Peon

    Messages:
    82
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The only rule you really need is:

    RewriteCond %{HTTP_HOST} !^456\.com$
    RewriteRule ^(.*) http://456.com/$1 [R=301,L]
    Code (markup):
    or

    RewriteCond %{HTTP_HOST} !^www\.456\.com$
    RewriteRule ^(.*) http://www.456.com/$1 [R=301,L]
    Code (markup):
    To redirect everything that does not have 456.com or www.456.com (choose one) to the new address.
     
    chadsmith, Jan 3, 2010 IP
    bad_bob00 likes this.
  3. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #3
    It doesnt redirect u because u didnt set this record

    redirect 301 / http://www.456.com
     
    Bohra, Jan 3, 2010 IP
    bad_bob00 likes this.