R
R
RZ2017-08-01 08:33:25
Yii
RZ, 2017-08-01 08:33:25

How to set default controller in subdirectory in Yii2?

Greetings, friends.
Is it possible, and if so, how to set a default controller for subdirectories in Yii?
For example, there is a controllers folder and it contains the SiteController file, and when the main page of the site is requested, it is the SiteController controller that works by default. And how to make it possible to set a default controller in a subdirectory too? For example, to get something like this controllers/user/defaultController.php and when accessing example.com/user, the defaultController controller worked.
I tried to set the name indexController, defaultController and siteController, but all in vain.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2017-08-01
@qonand

Use modules to solve your problem

A
Andrey Tokmakov, 2017-08-01
@NPC

In config'defaultRoute' => 'user/default/index'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question