Mod Rewrite - tricky one... Forward to a new domain?

Discussion in 'Apache' started by londonhogfan, Aug 4, 2008.

  1. #1
    Hello,

    I am trying to figure out a way to forward all links from my photo gallery which is located here.

    http://www.razorbacklegacy.com/hog_archive/

    to my new domain. Here.

    http://www.hogdb.com/razorback-photos/

    I have moved it to another server and I'm trying to avoid broken links before I close the original gallery. links from the original gallery look like this.

    http://www.razorbacklegacy.com/hog_archive/index.php?cat=41
    which is now
    http://www.hogdb.com/razorback-photos/index-41.html

    http://www.razorbacklegacy.com/hog_archive/thumbnails.php?album=272
    now...
    http://www.hogdb.com/razorback-photos/thumbnails-272.html

    http://www.razorbacklegacy.com/hog_archive/displayimage.php?album=272&pos=0
    is now
    http://www.hogdb.com/razorback-photos/displayimage-272-0.html

    Can anyone help me out with this?

    Thanks in advance.
     
    londonhogfan, Aug 4, 2008 IP
  2. londonhogfan

    londonhogfan Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sorry... Couldn't edit the original post.

    I have setup mod rewrites on the new server to give me better SEO on the links, but I can't find a way to auto forward everything from the old site to the new domain. Can anyone help me out with this?
     
    londonhogfan, Aug 4, 2008 IP
  3. david_t

    david_t Member

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #3
    Have you looked into making a 302 redirect (permanent movement)?
     
    david_t, Aug 4, 2008 IP
  4. londonhogfan

    londonhogfan Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thats what I'm wanting to do.

    Just wondering if it's possible (since the links are dynamic) if there is a way to do all of them with a few lines instead of probably 10,000 that it would take if I went link by link.
     
    londonhogfan, Aug 4, 2008 IP
  5. david_t

    david_t Member

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #5
    I meant a 301 redirect, sorry there. Anyway, this should do the trick, if I understood you correctly.
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
    Code (markup):
     
    david_t, Aug 5, 2008 IP
  6. londonhogfan

    londonhogfan Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    that works pretty well. However it sends to the dynamic url like the original domain uses instead of the rewritted url I'm doing on the new domain.
     
    londonhogfan, Aug 5, 2008 IP
  7. david_t

    david_t Member

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #7
    Hmm.. The code posted above should be used on the old server. And the new server will have to take care of allowing both old-style urls(?id=xxx) and the new one style urls(/id/xxx/). Or am I missing something here?
     
    david_t, Aug 5, 2008 IP