ModRewrite with changing dynamic URL's

Discussion in 'Apache' started by ryanrbftp, Oct 6, 2009.

  1. #1
    Hi Guys, I'm looking for a mod rewrite redirect rule for the following.

    Redirect this:
    http://flyawaysimulation.com/modules.php?name=My_eGallery
    Code (markup):
    To This:
    http://flyawaysimulation.com/modules.php?name=Images
    Code (markup):
    I also want to redirect queries following that, for example I also want to redirect:
    http://flyawaysimulation.com/modules.php?name=My_eGallery&do=showpic&pid=5057
    Code (markup):
    To This:
    http://flyawaysimulation.com/modules.php?name=Images&do=showpic&pid=5057
    Code (markup):

    I've searched high and low, and most examples online only take one query into consideration.

    Thank you for your help.
     
    ryanrbftp, Oct 6, 2009 IP
  2. chadsmith

    chadsmith Peon

    Messages:
    82
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteCond %{QUERY_STRING} ^name=My_eGallery(&.*)?$
    RewriteRule ^modules\.php$ /modules.php?name=Images%1 [R=301,L]
    Code (markup):
     
    chadsmith, Oct 7, 2009 IP
  3. ryanrbftp

    ryanrbftp Member

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    That works like a charm, I had something very similar to that but couldn't seem to get it working... I was using $1 instead of %1 I think...

    Thank you for your help, really appreciated.

    We also have the following:
    http://flyawaysimulation.com/modules.php?op=modload&name=My_eGallery&file=index&do=showpic&pid=4354
    Code (markup):
    That needs redirecting to:
    http://flyawaysimulation.com/modules.php?name=Images&do=showpic&pid=4354
    Code (markup):
    What would the code be?

    Thank you again. :)
     
    ryanrbftp, Oct 8, 2009 IP