Answer the question
In order to leave comments, you need to log in
How to remove controller/index from link?
Hello. I have a controller, for example, a site that has a default route of index, how to make it so that after following a link to this address, the default route is not displayed, that is, the link is domain/site and not domain/site/index.
Answer the question
In order to leave comments, you need to log in
If you need to make the main page of the site open as domain/site, then specify 'defaultRoute' => '/site' in the config.
If it's just a controller, then you can either simply refer to it without an action, for example:
or beat this situation through the urlManager rules, for example:
'rules' => [
'<controller>' => '<controller>/index' // если ссылка вида controller/index - формируем ее просто как ссылку на контроллер
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question