url management in Yii 2
10,120
Unfortunately this feature didn't migrate to Yii2, you can still define such rules manually
'books/view/queryString/<queryString:\w+>' => 'books/view',
Link on github with this issue
Because of many client API and Oauth servers don't work without encode
Author by
KB9
Updated on July 25, 2022Comments
-
KB9 almost 2 years
I have this url
http://example.com/index.php/controller_name/action_name?queryString=123
This url is working fine but when I am trying to use the queryString like in the old version of Yii
http://example.com/index.php/controller_name/action_name/queryString/123
I get an "unable to solve request" error.
I 've already enable prettyurl in my config file and the following url is working
http://example.com/index.php/controller_name/action_name.
My config looks like :
'urlManager' => [ 'class' => 'yii\web\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', 'module/<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>', ], ],
What am I missing?