W
W
Web Samurai2021-02-16 22:14:48
Yii
Web Samurai, 2021-02-16 22:14:48

How to bring links in cnc view YII2?

Please tell me what instructions you need to write in web/urlManager/rules so that the links
- to the category were: /categoryname/
- the link to the article was: /categoryname/articlename , or even better just /articlename

And if you can explain how it is configured, according to the official documentation fails to do.

Now the links look like this:
https://sitename /site/category?slug=categoryname
https://sitename /site/post?slug=articlename

Tried:

// хлебные крошки
 'page/<page:\d+>'   => 'site/index',
'/'                 => 'site/index',

 // категория
 '<slug:>'           => 'site/category',

 // пост
  '<slug:>'           => 'site/post',


So either the CNC works on the category or on the record.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question