[thelist] mod_rewrite regular expression [FIXED]

Simon Perry thelist at si-designs.co.uk
Tue Jul 13 11:48:09 CDT 2004


David Kaufman wrote:

>in ancy case, try this rule and see if it works for you:
>
>RewriteRule ^flights/([a-zA-Z0-9_]+)$ /re_engine/flights.php?area=$1
>
>iirc, perl's \w "word" metacharacter is not be supported by mod_rewrite's
>regex engine.  in which case you have to "spell out" the characters in the
>word character class, which are upper and lower letters, all 10 digits, and
>the underscore.
>
>also it looks like you have too many +'s in your backreference
>(parenthesized part of the) pattern, unless you really did want to allow and
>match area name strings with plus signs in them.
>
>the reason you got a 404 from that was that [\w+] was interpreted as a
>literal w and the plus sign, making the pattern (almost) never match... it
>would only have rewritten URL's such as:
>    flights/w+w
>to  /re_engine/flights.php?area=w+w
>
>  
>
Spot on thanks Dave


More information about the thelist mailing list