Category-slug/Product-slug on Product Detail Rewrite

Topics: Developer Forum, Project Management Forum, User Forum
Jan 8, 2009 at 5:41 AM
Edited Jan 8, 2009 at 7:31 AM
Hi All,

I wanted some advice on how to best write the following scenario.

I have the following rules currently written:

http://www.mydomain.com/category-slug.html
Real URL: index.cfm?page=listing&categoryslug=category-slug

http://www.mydomain.com/shop/content-slug
Real URL: index.cfm?page=content-slug

I'd like to have http://www.mydomain.com/category-slug/product-slug.html as my final product URL.

How would i go about adding the above from the Real URL:
index.cfm?page=productdetail&categoryslug=category-slug&productslug=product-slug

I have the following script so far:

RewriteRule ^/shop/([a-zA-Z0-9_-]+)$ /index.cfm?page=$1
RewriteRule ^/([a-zA-Z0-9_-]+)\.html$ /index.cfm?page=listing&categoryslug=$1
RewriteRule ^/([0-9]+)/([0-9]+)/([a-zA-Z0-9_-]+)\.html$ /index.cfm?page=listing&categoryslug=$3&StartRow=$2&PageNum=$3
MaxMatchCount 50

I need to add variables like productrequest=1 into the chain also.

Any advice on how to optimise the current script is welcome.

Thanks,

Leigh