Forum Moderators: phranque

Message Too Old, No Replies

regular expression help in htaccess

htaccess and regular expressions

         

dave_c00

10:00 am on Oct 11, 2005 (gmt 0)

10+ Year Member



Hi,

I have currently go this rewrite code in my htaccess file which redirects products to a products page with the number after and then the name of the product after that all seperated by hyphens.

RewriteRule proddetail-(.*)-(.*)\.html$ proddetail.php?prod=$1 [L]

However if the product name is more than one word like yellow-hat then i need the expression to allow a many hyphened product name afterwards. I have tried using the + in different areas e.t.c but am getting no luck. Any ideas

Thanks
Dave

dcrombie

12:54 pm on Oct 11, 2005 (gmt 0)



RewriteRule proddetail-([^-]+)-(.+)\.html$ proddetail.php?prod=$1 [L]

;)