M
M
MaoCzedun2015-10-01 07:16:37
Yii
MaoCzedun, 2015-10-01 07:16:37

URL route for a module in Yii2, how to set it correctly?

The question is how to correctly write routes in Yii2 basic to call the controller and action
so that the url is of the form hostname/site/moduleName/controllerName/actionName ?
trying to do so

'rules' => [
                '/' => 'site/index',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
//                '<module:\w+>/<controller:\w+>/' => '<module>/<controller>/index',
                'site/<module:admin>/<controller:\w>/<action:\w+>'=>'site/<module>/<controller>/<action>'
//                '<module:admin>/<controller:\w+>' => '<module>/<controller>/index',
            ],

but it throws out 404

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question