[thelist] Regexp help

Joshua Olson joshua at waetech.com
Wed Jan 26 09:32:36 CST 2005


> -----Original Message-----
> From: Razvan Pop
> Sent: Wednesday, January 26, 2005 9:40 AM
> 
> Hello,
> 
>     Can anyone take a look and tell me what is wrong with this?
> 
>     RewriteRule ^/([a-zA-Z]+)$ /default.php?sLinkCat=$1 [L]

Stab in the dark since you didn't mention if this is mod_rewrite or
isapi_rewrite or what problem you are seeing...

Excape the . and ?

RewriteRule ^/([a-zA-Z]+)$ /default\.php\?sLinkCat=$1 [L]

On anther note, this regex is not entirely hardened.  Consider this example
of a test string:

/abc/

It's a valid url, but the regex doesn't like the trailing /.

Change the regex to the following to allow for the optional /:

^/([a-zA-Z]+)/?$

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168 





More information about the thelist mailing list