Forum Moderators: phranque
www.example.com/items/var1/var2/var3/123-ABC-47.7
above url will not work with current mod rewrite below:
RewriteRule ^items/([A-Za-z0-9-]+)/?$ item.php?var1=$1 [NC,NS,L]
RewriteRule ^items/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ item.php?var1=$1&var2=$2 [NC,NS,L]
RewriteRule ^items/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ item.php?var1=$1&var2=$2&var3=$3 [NC,NS,L]
RewriteRule ^items/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ item_detail.php?itemid=$4 [NC,NS,L]
thanks
[edited by: jdMorgan at 4:16 am (utc) on Jan. 27, 2009]
[edit reason] example.com [/edit]
[a-z0-9\-.,/+] as your character class. The NC flag compiles the regEx case-intensive, so you don't need to specify the upper-case A-Z. The hyphen is a spacial character in a character class, hence it needs escaping (there are special cases where you don't need to escape the hyphen, e.g. at the beginning or end, and in between depending upon the other characters around).