Answer the question
In order to leave comments, you need to log in
How to remove the name of 1 controller from the URL?
We have, for example, 2 controllers SiteController and UserController, respectively, the url is obtained
:
mysite.ru/site/index
mysite.ru/user/index
accessing mysite.ru/index to access SiteController
The config now says:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => true,
'rules' => [
[
'pattern' => '',
'route' => '',
'suffix' => '',
],
[
'pattern' => '<controller>/<action>/<id:\d+>',
'route' => '<controller>/<action>',
'suffix' => '',
],
[
'pattern' => '<controller>/<action>',
'route' => '<controller>/<action>',
'suffix' => '',
],
[
'pattern' => '<module>/<controller>/<action>/<id:\d+>',
'route' => '<controller>/<action>',
'suffix' => '',
],
[
'pattern' => '<module>/<controller>/<action>',
'route' => '<controller>/<action>',
'suffix' => '',
],
],
],
Answer the question
In order to leave comments, you need to log in
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => true,
'rules' => [
'/' => 'site/index',
'/index' => 'site/index',
[
'pattern' => '',
'route' => '',
'suffix' => '',
],
[
'pattern' => '<controller>/<action>/<id:\d+>',
'route' => '<controller>/<action>',
'suffix' => '',
],
[
'pattern' => '<controller>/<action>',
'route' => '<controller>/<action>',
'suffix' => '',
],
[
'pattern' => '<module>/<controller>/<action>/<id:\d+>',
'route' => '<controller>/<action>',
'suffix' => '',
],
[
'pattern' => '<module>/<controller>/<action>',
'route' => '<controller>/<action>',
'suffix' => '',
],
],
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question