Answer the question
In order to leave comments, you need to log in
How to correctly specify links in yii2?
In the news module, I display a link to the news in this way
<?= Html::a($model->title, ['view', 'slug' => $model->slug, 'id' => $model->id]) ?>
'post/<slug:[\w_-]+>/<id:\d+>' => '/post/default/view',
domen.ru/post/nazvanie/28
domen.ru/site/default/view?slug=nazvanie&id=28
Answer the question
In order to leave comments, you need to log in
<?= Html::a($model->title, ['/post/default/view', 'slug' => $model->slug, 'id' => $model->id]) ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question