Changing to new domain but keeping the same file structure - how?

Discussion in 'Apache' started by heapseo, Nov 14, 2006.

  1. #1
    I have read alot about this but have never actually managed to get it to work - here is what I need to do:

    A site is currently at: http://www.sub.domain1.com
    And I want to redirect it to hrrp://www.sub.domain2.com

    The file structure will be exactly the same on the new domain, so the only thing that will be changing is *domain1* to *domain2*.

    I'm sure this isn't a complex task, I just haven't managed to figure out how to do it, so any help is appreciated :)
     
    heapseo, Nov 14, 2006 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    It all depends on your hosting provider, whatever web host I use, I have the following directories under www www/domain1.com/ www/domain2.com /, I will just move the directory sub from www/domain1.com/ to www/domain2.com
     
    it career, Nov 14, 2006 IP
  3. heapseo

    heapseo Peon

    Messages:
    636
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #3
    the new domain is on a different host - does that cause a problem?
     
    heapseo, Nov 14, 2006 IP
  4. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #4
    Unless your webhosting provider is allowing you to zip the folder sub and upload it to new webhosting provider and unzip, I think you might have to copy the content yourself manually.

    You have lot of work, since you need to manualy create the same file structure in new hos
     
    it career, Nov 14, 2006 IP
  5. heapseo

    heapseo Peon

    Messages:
    636
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #5
    copying the content / filestructure isn't a problem, its the redirect that is causing issues at the moment.
     
    heapseo, Nov 14, 2006 IP
  6. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #6
    Ok, you can use this as index.htm of sub.domain1.com

    <HTML>
    <HEAD>
    <META HTTP-EQUIV="refresh" content="5;URL=http://sub.domain2.com/">
    <TITLE>This Page has moved</TITLE>
    </HEAD>
    <BODY>
    <a href="sub.domain2.com"> Click here if you do not get redirected with 5 seconds </a> </br>
    </BODY>
    </HTML>
     
    it career, Nov 14, 2006 IP
  7. heapseo

    heapseo Peon

    Messages:
    636
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I need to do it properly for the sake of the searhc engines and my traffic so I need to be able to 301 rather than meta redirect.

    Also I need to be able to redirect all old pages to their equivalent new ones - so if someone went to http://www.sub.domain1.com/dir1/dir2/index.html they would be redirected to http://www.sub.domain2.com/dir1/dir2/index.html
     
    heapseo, Nov 14, 2006 IP
  8. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #8
    If your domains are with namecheap, you can edit domain1.com's All Host Record where you can create a entry for sub so that sub.domain1.com gets redirected to sub.domain2.com
     
    it career, Nov 14, 2006 IP
  9. heapseo

    heapseo Peon

    Messages:
    636
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #9
    sorry, neither are with namecheap

    Can anyone help on the correct 301 implementation?

    Cheers.
     
    heapseo, Nov 14, 2006 IP
  10. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #10
    Who is your domain registrar?
     
    it career, Nov 14, 2006 IP
  11. heapseo

    heapseo Peon

    Messages:
    636
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I won't be setting up any kind of redirects via my domain registrar - I will be doing it via htaccess using modrewrite as this is the most search engine friendly way - I know this, I just don't know how to do it properly.
     
    heapseo, Nov 15, 2006 IP
  12. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #12
    Add something like this in .htaccess file
    Redirect /olddirectory http://yoursite.com/newdirectory/
     
    it career, Nov 15, 2006 IP
  13. heapseo

    heapseo Peon

    Messages:
    636
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #13
    heapseo, Nov 15, 2006 IP