I have problem with create pretty url with URLManager Rules in yii2.
My SiteContoller have actionProduct($slug)
and it generates url: http://localhost/myweb/web/site/product?slug=new-product-name
and I would like create url like: http://localhost/myweb/web/produkt/new-product-name
.
I tried to use some rules:
-
'site/product/<slug:\w+>' => 'produkt/<slug:\w+>',
-
'<controller:\w+>/<slug:[A-Za-z0-9 -_.]+>' => 'produkt',
'<controller:site>/<action:product>/<slug:\w+>' => 'produkt',
'/site/product/<slug:\w+>' => 'produkt',
but it's doesn't work.