How to set default controller in Yii
24,905
Solution 1
To set your default controller as your homepage's controller on Yii PHP-Framework. You must modify the core defaults controller (site/index) on your /protected/config/main.php
return array(
'name' => 'Web Application',
'defaultController' => 'home ',
);
Solution 2
try to add the configuration in the config main.php
'defaultController' => 'newcontrollername',
after 'name' setting.
Author by
JohnnyQ
I'm a Ninja from a Hidden Village. I can solve and create problems and solve again. SOreadytohelp
Updated on July 09, 2022Comments
-
JohnnyQ almost 2 years
Is there a way to specify a default controller in Yii? Instead of using the SiteController? Thank you in advance.
-
Moyed Ansari almost 12 yearsDefaultController will simply be called when you call yoursite/yourmodule. You don't need to change its name to make it work.
-
tread over 8 yearsYou shouldn't edit files that are part of the framework because they may change during an update and your changes lost.