How to 301 redirect old website

Discussion in 'HTML & Website Design' started by ppljoe, Aug 20, 2009.

  1. #1
    Ok, I've tried to do a 301 from an old website to the new with the .htaccess file. After I've added the information and uploaded to the web host, I don't get transferred to the new domain. Can somebody show me some code that I could implement? All of the htaccess code I Googled didn't work for me.

    Thanks,

    Joe
     
    ppljoe, Aug 20, 2009 IP
  2. 45kollman

    45kollman Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    WOuldn't it be easier to just to set up the domain as an alias? Then you wouldn't need a redirect.
     
    45kollman, Aug 20, 2009 IP
  3. ppljoe

    ppljoe Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I want to do the 301 to get the link juice flowing to the new site. My client has a PR2 that I want to take advantage of.
     
    ppljoe, Aug 20, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    All you have to place in the .htaccess is this:

    Redirect 301 / http://www.newdomain.com/
    
    Code (markup):
     
    premiumscripts, Aug 20, 2009 IP
  5. ppljoe

    ppljoe Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I did do this, although this is how I did it below.

    Redirect 301 index.html http://www.newdomain.com/index.html
     
    ppljoe, Aug 20, 2009 IP
  6. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Well, my solution will also redirect all subpages. You may be interested in that, or not.
     
    premiumscripts, Aug 20, 2009 IP
  7. ppljoe

    ppljoe Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Yes, I would be interested in doing all sub pages. But wouldn't I have to manually do each page? I mean, what if somebody clicked on a link to an old subpage? They would be forwarded to the top domain right? From what I gather, I would have to redirect each page to it's corresponding page on the new domain? It shouldn't be too bad since this site is relatively small if that's what I've got to do. I really appreciate your help.
     
    ppljoe, Aug 20, 2009 IP
  8. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Nope, if you just use my code, all subpages will also be redirected to the correct new location :) htaccess simply uses the first / to match the request, and then sends everything at the end of the URL to the new location. At least, it works for me.
     
    premiumscripts, Aug 20, 2009 IP