Redirect with parameters??

Discussion in 'Apache' started by 123GoToAndPlay, May 12, 2010.

  1. #1
    Hi there,

    Still not comfortable with redirect/rewriterules. I like to redirect

    www.mydomain.com/index2.php?var1=adf
    www.mydomain.com/index2.php?var1=adf&va2=asdf
    etc
    to
    www.mydomain.com/newfolder

    I tried these
    
    RewriteRule /index2.php/$1 http://www.mydomain.com/newfolder/
    #Redirect 301 /index2.php http://www..com/newfolder/
    
    Code (markup):
    The second one only seems to work if there are more then one parameters, but i doesn't work for
    
    www.mydomain.com/index2.php?var1=adf
    
    Code (markup):
    How do i fix this??
     
    123GoToAndPlay, May 12, 2010 IP
  2. chadsmith

    chadsmith Peon

    Messages:
    82
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Should be as simple as:

    RewriteRule ^index2\.php$ /newfolder [R=301,L]
    Code (markup):
    Query strings will be added automatically.
     
    chadsmith, May 12, 2010 IP