K
K
kpa6uu2017-09-15 01:03:54
Yii
kpa6uu, 2017-09-15 01:03:54

How to set default controller in yii2 for subdirectory?

Greetings.
There is a directory of controllers
app/controllers
Created a subdirectory
app/controllers/test
If in the base directory of controllers the default controller is SiteController , which is called
when the application accesses app.domain/,
then how to set the default controller for the subdirectory?
Thank you.
PS: there were similar questions in Google, but they all ended in withers rejected by the Yii developers.
If I'm moving in the wrong direction, where is it better to dig?
ZY: I plan to dig towards the creation of a new module.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Korobkov, 2017-09-15
@kpa6uu

Similar. The defaultRoute property in WebApplication.
For a module, this is the same property in Module.

J
JamanKell, 2017-11-13
@JamanKell

Use the controllerMap property if you want to set controllers from the test namespace only for certain routes and controllerNamespace if you want all routes to be processed by controllers from this namespace.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question