Answer the question
In order to leave comments, you need to log in
How to remove "default" from Yii2 module for DefaultController only?
Hello. The task is to remove "/default/" from the DefaultController URL, i.e. so that the path like "/ticket/default/new" becomes "/ticket/new". To do this, I use the solution with urlManager:
'<module:\w+>/<action:\w+>/<id:(.*?)>' => '<module>/default/<action>',
'<module:\w+>/<action:\w+>' => '<module>/default/<action>',
'<module:\w+>' => '<module>/default/index',
<controller>
" in the rules - it did not help.
Answer the question
In order to leave comments, you need to log in
Good morning.
Try like this
'<_m:[\w\-]+>' => '<_m>/default/index',
'<_m:[\w\-]+>/<_c:[\w\-]+>' => '<_m>/<_c>/index',
'<_m:[\w\-]+>/<_a:[\w\-]+>/<id:\d+>' => '<_m>/default/view',
'<_m:[\w\-]+>/<_c:[\w\-]+>/<_a:[\w\-]+>' => '<_m>/<_c>/<_a>',
'<_m:[\w\-]+>/<_c:[\w\-]+>/<id:\d+>/<_a:[\w\-]+>' => '<_m>/<_c>/<_a>',
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question