mod_rewrite

Discussion in 'Apache' started by trnsfrmr, Mar 13, 2007.

  1. #1
    Can anyone tell me why this might not be working:

    RewriteEngine On
    RewriteRule ^index.php?keywords=([A-Za-z0-9-+"'() ]+)/?$ http://www.mysite.com/search/$1 [R]
    Code (markup):
    ?
     
    trnsfrmr, Mar 13, 2007 IP
  2. trnsfrmr

    trnsfrmr Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Problem solved over on another forum.

    I wasn't aware that you couldn't use RewriteRules directly on query strings.

    Use a conditional fixes the problem!
     
    trnsfrmr, Mar 13, 2007 IP
  3. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #3
    why don't you post your solution for the sake of anyone else with that problem?
     
    frankcow, Mar 13, 2007 IP
  4. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #4
    He did. Only the requested file is matched to the pattern in a RewriteRule. To do a match on a query string (everything after after ?), you'd need to use RewriteCond %{QUERY_STRING} #pattern#
     
    rodney88, Mar 13, 2007 IP