Hello colleagues. On yii2 set a strict rule for Uri:

'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'enableStrictParsing' => true ] 

I can not figure out how to write a rule now to hide the controller for the main one. Those. Now http://domain.ru/site , you need http://domain.ru/ . For the rest of the Uri such rules are prescribed.

 'rules' => [ '<action:(contact|about|captcha)>' => 'site/<action>', '<controller:[-\w]+>/index' => '404', '<controller:[-\w]+>' => '<controller>/index', '<controller:[-\w]+>/<id:\d+>' => '<controller>/view', '<controller:[-\w]+>/<action>' => '<controller>', ] 
  • one
    'request' => [ 'baseUrl' => '', ], ,? ........ and in the rules it is still possible to add '/' => 'site/index', - Alexey Shimansky
  • Thank you, it was enough to write down the rule - Evgeny

0