mod_rewrite - Comma In URL

Discussion in 'Apache' started by SamOwen, Mar 3, 2007.

  1. #1
    I have been at this for awhile and can't find a solution.

    I have this line in my .htaccess:
    RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9]+)/([0-9]+)$ /search.php?query=$1&location=$2&zip=$3

    Location can take commas that are returned as %2C in the URL. Example: City,State. If I search using just a city name it works, but if I search using City,State it doesn't work. How can I add a comma into the regular expression?
     
    SamOwen, Mar 3, 2007 IP
  2. SamOwen

    SamOwen Peon

    Messages:
    865
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is this impossible?
     
    SamOwen, Mar 6, 2007 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    ([^.]+)

    if that doesn't do it

    (.*)
     
    Nintendo, Mar 6, 2007 IP
  4. SamOwen

    SamOwen Peon

    Messages:
    865
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks. :) Now I know why when I used (*.) I got errors.
     
    SamOwen, Mar 9, 2007 IP