How to redirect a whole domain?

Discussion in 'Site & Server Administration' started by Emil, Feb 19, 2007.

  1. #1
    Hey, guys!

    I've changed the name of one of my sites and therefor also the domain name.

    And I was wondering if there's any way to redirect the whole old domain to the new domain?

    The old domain is dashadyboard.com and the new domain is hiphopdefined.com.

    And this is what I want to do. No matter what you type after dashadyboard.com (ie. dashadyboard.com/pagename1.php, dashadyboard.com/forumdisplay.php?f=37, etc etc), I want you to be redirected to the new domain hiphopdefined.com/forum. So if you're trying to access a thread on the old domain, you should just be redirected to the new domain's home page.

    Is this possible to do in any way?
     
    Emil, Feb 19, 2007 IP
  2. santoshgs

    santoshgs Banned

    Messages:
    208
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do you use a control panel such as CPanel ? There will be an option "redirects" where you can setup a redirection.

    OH, almost missed a point - if I'm not mistaken, you can also forward a domain from your domain control panel.
     
    santoshgs, Feb 19, 2007 IP
  3. santoshgs

    santoshgs Banned

    Messages:
    208
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Darn, missed another point - en.wikipedia.org/wiki/Domain_forwarding Wikipedia is always there! :)
     
    santoshgs, Feb 19, 2007 IP
  4. tkilgore

    tkilgore Well-Known Member

    Messages:
    1,075
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    160
    #4
    a "301 redirect" is the best way to keep your site in check with Google. And to forward what you need.. you can even use a .htaccess file to do the same.
     
    tkilgore, Feb 19, 2007 IP
  5. Emil

    Emil Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    lol yeah I tried the cpanel option, but it didn't redirect the whole domain. I have to manually add every page that I want to be redirected. :(

    Could you please explain to me or show an example of the code I need to use to do this?
     
    Emil, Feb 19, 2007 IP
  6. oziman

    oziman Active Member

    Messages:
    199
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Your .htaccess should look something like this:
    RewriteCond %{HTTP_HOST} ^www.oldhost.com
    RewriteRule ^(.*)$ http://www.newhost.com/$1 [r=301,L]
    Code (markup):
    That should do the trick..
     
    oziman, Feb 20, 2007 IP
    gford likes this.
  7. Emil

    Emil Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks a lot, I'll try that! :)
     
    Emil, Feb 20, 2007 IP
  8. Emil

    Emil Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Nope, that didn't work for some reason. Nothing happens :(


    EDIT: This one worked though

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
    Code (markup):
     
    Emil, Feb 20, 2007 IP
  9. oziman

    oziman Active Member

    Messages:
    199
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #9
    My Bad...

    You need to have ReWriteEngine ON before you implement my code..

    Sorry:-(
     
    oziman, Feb 23, 2007 IP
    samm27 likes this.
  10. carl_in_florida

    carl_in_florida Active Member

    Messages:
    1,066
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    90
    #10
    I had to do this. google header redirect. That is what worked for me.
     
    carl_in_florida, Feb 25, 2007 IP