htaccess 301 redirect to new folder with page name changes

Discussion in 'Apache' started by ibloomdrop, Oct 24, 2010.

  1. #1
    This looks like it would be simple....for someone who knows what they are doing.

    I need to redirect like a million pages with this format:

    old:
    http://www.mydomain.com/game_9354_zuzu-pirates_en_pc.html
    new:
    http://mydomain.com/newfolder/gameinfo.php?id=9354&foldername=zuzu-pirates&local=en&gtype=pc

    I've been searching for the answer. I see that most of the parts of the URLs match, just in different spots. I know I need some sort of a query string, but I'm lost on all the other symbols.

    Not sure what to do with the different between www and no www either, but that's not important right now. I'd just really like to get the bazillion urls in Google redirecting to where they need to go.

    Thank you in advance!!
     
    ibloomdrop, Oct 24, 2010 IP
  2. scriptinstaller

    scriptinstaller Peon

    Messages:
    109
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    scriptinstaller, Oct 24, 2010 IP
  3. scriptinstaller

    scriptinstaller Peon

    Messages:
    109
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    scriptinstaller, Oct 24, 2010 IP
  4. ibloomdrop

    ibloomdrop Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That is just magical!!

    You guys are THE best ever! Thank you so very much for taking the time (and so quickly) to respond. I had to fool with it a bit, which is great. I love puzzles!! I've got it working and it's amazing. ;)

    For any future lurkers, here's what I ended up with:

    RewriteRule ^game_([0-9]+)_(.*?)_(.*?)_(.*?).html$ /newfolder/gameinfo.php?id=$1&foldername=$2&local=$3&gtype=$4 [L,R=301]

    I didn't think to change the = to %2F. What is the reason behind that so I can do some research?

    Thanks again!!
     
    ibloomdrop, Oct 24, 2010 IP
  5. scriptinstaller

    scriptinstaller Peon

    Messages:
    109
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    sorry i mean %3D
    its the proper encoding for url's
    / = %2F
     
    scriptinstaller, Oct 24, 2010 IP
  6. scriptinstaller

    scriptinstaller Peon

    Messages:
    109
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Glad it worked out for you :-D
    Click on that star, i can use and love me some rep :D thanks
     
    scriptinstaller, Oct 24, 2010 IP