How can I remove the controller name from URLs in Yii2?
I'm aware of simple aliases, but I'm not sure how to apply aliases to a little bit more complex rule, like the following one:
'rules' => [
'public/<seo_url:.*?>/<category_id:\d+>/<product_id:\d+>' => 'public/product'
]
This will create a rule so URLs like /product/this-is-a-slug/94/12
will call the actionProduct
in my Public
controller.
How can I make an alias that would call that same action if I try to access a product using this URL: /this-is-a-slug/94/12
?
Set new rulw on top of all rules. Like that:
This is work for me.