Htaccess Mod_rewrite question

Discussion in 'Apache' started by DareDevilHosting, Feb 26, 2010.

  1. #1
    I want to change

    index.php?search=X&page=B
    to /search/B/X.html

    I have

    RewriteRule ^search/([^/]*)/([^/]*)\.html$ /index.php?page=$1&search=$2 [R=301,L]

    but I want to make it change to the rewritten one when someone submits on my form
     
    DareDevilHosting, Feb 26, 2010 IP
  2. MrYu

    MrYu Peon

    Messages:
    157
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The left side of RewriteRule is what you want to change, the right side is what you want to change it to. So your expression should be something like the follows (UNTESTED!):

    RewriteRule ^index\.php\?search=(.+)&page=(.+)$ /search/$2/$1.html [R=301,L]
     
    MrYu, Feb 27, 2010 IP