I am trying to workout a custom URL requirement. We are a product based website, and url to each product is like
https://www.domainname.com/product/index/id/product_id
Now i want the urls to be user friendly and something like this…
https://www.domainname.com/productcustomurl
To achieve this i have created a field named custom_url in the table product where the customurl will be stored by product creator during the product creation. For this i have created a rule in the params.php like this:
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
'<id:(.*?)>' => 'product/index' //this rule
assuming this will redirect user whenever anyone hits
https://www.domainname.com/productcustomurl
with productcustomurl in parameter id, which is working fine, but the problem is this is redirecting each and everything to the product/index overriding all the other routes like site or user etc etc, which is an issue. I want them to be working. How do i achieve it, without affecting the normal routes of the website?? Please help.
[color="#008000"][EDIT @softark]
Added "code" tags for readability.
[/EDIT][/color]