Answer the question
In order to leave comments, you need to log in
How to defeat URLmanager again?
I have a question here are the rules
'serials/<slug:\w*>' => 'serial/category/list',
'serials/<id>' => 'serial/category/oneserial',
Yii::$app->urlManager->createUrl(['/serial/category/oneserial','id'=>$model->slug_serial]) //ссылка формируется такая /serials/serial-nazvanie-seriala
Yii::$app->urlManager->createUrl(['/serial/category/list','slug'=>$ct->slug_category])//ссылка формируется такая /serials/сategory
'serials/<slug:\w*>' => 'serial/category/list',
'serials/<slug:[\w_\-]+>' => 'serial/category/list',
'serials/<id>' => 'serial/category/oneserial',
Answer the question
In order to leave comments, you need to log in
You are trying to open both the category and the series itself, in the same 'serials' prefix. There are no problems when creating a url, but when parsing, yii takes the first matching rule.
Create a better class of rules url Creating Rule Classes , and search the database, there is a series forwarding on the series, if not, check the category and if it exists on the category.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question