Here is the structure of the module (serial) controller (category) action (oneserial). made such a rule.

'serial/<id:/w+>'=>'serial/category/oneserial' 

here I try to write the address of the link

 <?= Yii::$app->UrlManager->createUrl(['serial/category/oneserial','id'=>$car->name_serial]) ?> 

I get this address

 http://film.lc/serial/category/oneserial?id=Перевозчик+(сериал) 

I want to get

 serial/Перевозчик+(сериал) 
  • You have a mistake in the regular season: not /w+ , but \w+ ... - Roman Grinyov
  • @RomanGrinyov did not help, but I agree: ( - Sergalas
  • In general, I tried to simulate (of course, with the correct regular schedule) your situation and everything goes as it should: serial/blablabla . So something you have with the rules for urlManager , but I think so ... - Roman Grinyov
  • @RomanGrinyov and you can show me this regular season. - Sergalas
  • I mean as I said above, in the first message: not /w+ , but \w+ . - Roman Grinyov

1 answer 1

 Yii::$app->UrlManager->createUrl('serial/' . $car->name_serial) 
  • 404 error fell out - Sergalas
  • changed Yii :: $ app-> UrlManager-> createUrl ('serial / category / serial /'. $ car-> name_serial) to Yii :: $ app-> UrlManager-> createUrl ('serial /'. $ car-> name_serial), I wrote the concept of how to do this, and you substitute the link according to how your routing is organized (try right now what's in the answer) - Lesiuk Alexey