Why don't you take a parameter?

public function actionView($slug) 

in view so

  <?=\yii\helpers\Html::a('LINK',[\yii\helpers\Url::to(['portfolio/view', 'slug' => $portfolio->slug])]); ?> 

I will debug in the Slug method that should arrive, NULL

it is clear that I can accept through the request het and this solves the problem. But I want to break up why it does not arrive

config

  'showScriptName' => false, 'enablePrettyUrl' => true, //отключаем index.php 'rules' => [ 'about' => 'site/about', 'portfolio/<slug:\w+>' => 'portfolio/view', 

    2 answers 2

    Error at the level of routing. Make sure that the specified parameter is specified in the router. If the CNC is used, then something like this: 'controller_name/<slug:\w+> => 'controller_name/view' . In the left part - the URL indicating the expected parameter, in the right - the controller and action.

    • this is naturally stated - mydls1
    • And url is generated /portfolio/slug ? - Viktor
    • yes instead of the slug from the database stretches the value - mydls1

    error in the kernel was, after the upgrade, the problem disappeared