Answer the question
In order to leave comments, you need to log in
How to create cnc links for yii2?
I have a url manager set up, but the links are not CNC like this site.ku/category/view?slug=pervaya
This is how I create this link
<?= Html::a('Первая категория', Yii::$app->UrlManager->createUrl(['/category/view' , 'slug' => $model->slug]); ?>
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'baseUrl' => '',
'rules' => [
'' => 'site/index',
//'<action>'=>'site/<action>',
'contact' => '/contact/index',
'about' => '/about/index',
'<_c:[\w\-]+>' => '<_c>/index',
'<_c:[\w\-]+>/<id:\d+>' => '<_c>/view',
'<_c:[\w\-]+>/<_a:[\w-]+>' => '<_c>/<_a>',
'<_c:[\w\-]+>/<id:\d+>/<_a:[\w\-]+>' => '<_c>/<_a>',
],
];
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