Answer the question
In order to leave comments, you need to log in
How to process such a rule in Yii2?
Good day. I've been struggling with this problem for over an hour now.
The essence of the problem is this:
there are links like
sitename.ru/post-o-chem-to1
sitename.ru/post-o-chem-to2/blabla/1
sitename.ru/post-o-chem-to3/blablabla/2
and there is a link like
sitename.ru/forum
How to write a rule so that first there is a check if forum/ is passed and if not. everything would go to another controller.
I think the actions are performed sequentially and wrote this code, but it does not work, the last action is performed:
'urlManager'=>[
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'/forum/' => 'forum/', // это правило пропускается, ссылка вида sitename.ru/forum/ игнорируется
'/<url:[a-zA-Z/0-0-]+>' => 'sitetopic/index' // это правило все перехватывает
]
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question