Answer the question
In order to leave comments, you need to log in
How to implement such a cnc in yii2?
How to make it so that when you go to the link:
www.site.ru/vasia - the personal page of the user Vasya
opens www.site.ru/news - the page of the site news opens.
The site is being developed on yii 2.
Users will share links to their profiles, it is necessary that they be as simple as possible.
As for the url of other sections of the site, it does not matter how they will look.
While there is one idea, check what is after / in the database. If there is no such user, then show the news page or something. But this is somehow wrong.
Answer the question
In order to leave comments, you need to log in
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'/news' => 'news/index', //Таких правил придётся делать на все подобные страницы
'/<user>' => 'user/view',
]
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question