Answer the question
In order to leave comments, you need to log in
How to generate a slug routing rule in Yii2 module?
There is a blog module.
There is a rule that blog/article1 should open an article'blog/<page:\w+(-\w+)*>'=>'blog/default/view'
'enablePrettyUrl'=>true,
'showScriptName'=>false,
'rules' => [
'blog/<page:\w+(-\w+)*>'=>'blog/default/view' // Вот это правило
'<controller:\w+(-\w+)*>/<id:\d+>' => '<controller>/view',
'<controller:\w+(-\w+)*>/<action:\w+(-\w+)*>' => '<controller>/<action>',
'<module:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>' => '<module>/<controller>/<action>',
'<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
'<module:\w+>/<controller:\w+>' => '<module>/<controller>/index',
]
Answer the question
In order to leave comments, you need to log in
The problem turned out to be a redirect without a slash to a page with a slash at the end
Should work. See debug, I'm sure that some method is already throwing an error in the controller, give the code of your actionView
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question