I have inherited a Yii2 application to maintain, and although I use PHP, I do not know enough about this framework. Therefore, I feel very insecure and confused at times.
For example, the application manages the backend and frontend separately, as if it were a multisite application.
On the frontend side, there is a urlManager array in config/main.php, in which all public routes are defined.
The backend, on the other hand, is in a subdomain, and there is no definition of routes in any configuration file (/common/config/* or /backend/config/* ), so I cannot understand how to generate new routes for this area.
Here is the docs about routing
It is the default behavior. You create a controller and it’s actions. Within module if you need. And you can access these pages associated with actions.
1 Like
Thank you for your reply, I’m still a bit confused but your link is very useful.
As per what documentation says, if I have a url like backend.domain.com/index.php?r=post, I should look for a PostController under backend space? and it refers to indexAction? or it refers to postAction inside SiteController under backend space?
Thank you in advance
For siteController, your url will be site/post and for PostController it will be just post. Default urls are controller-name/action-name if no action provided then it will be default to index action of controller.
2 Likes