Answer the question
In order to leave comments, you need to log in
How to properly set up URL manager in Yii2?
Good afternoon, there is a backend called admin
url-manager with the following configuration:
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => true,
'rules' => [
''=>"site/index",
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
'/<action:\w+>'=>'site/<action>',
],
],
Answer the question
In order to leave comments, you need to log in
Found a solution like this:
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
''=>'site/index',
'/<action:users>'=>'users/all',
'/<action>'=>'site/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question