How to redirect domain ?

Discussion in 'Programming' started by Fififa, Oct 13, 2009.

  1. #1
    Hello, i want to redirect domain, from domain a.com to b.com.
    I want all request to a.com will change to b.com and let google bot know it.

    Ex : a.com => b.com
    a.com/1.php => b.com or b.com/1.php


    I running with linux/apache
     
    Fififa, Oct 13, 2009 IP
  2. vanyinet

    vanyinet Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You should add to .htaccess file on a.com this code:
    
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www\.)?a\.com
    RewriteRule (.*) http://www.b.com/$1 [R=301,L] 
    
    Code (markup):
     
    vanyinet, Oct 13, 2009 IP
  3. sunchiqua

    sunchiqua Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
  4. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #4
    vanyinet's solution is the right one to use.
     
    plog, Oct 13, 2009 IP
  5. Fififa

    Fififa Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you.

    Do i need to create a redirect page in a.com/index.html or a.com/index.php ?
     
    Fififa, Oct 13, 2009 IP
  6. pneulameiro

    pneulameiro Peon

    Messages:
    440
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    No, you don't need to create a redirect page.
     
    pneulameiro, Oct 13, 2009 IP