What's the best practice for changing home page?

Using CWebApplication::setHomeUrl()? And which file should I place this statement into?

You can simply add it to the application config.




'homeUrl' => 'http://example.com',


'components' => array(

...



Note sure if this is ‘best practice’, but I wanted more programatic control over the home page. Since by default Yii calls the SiteController actionIndex method you can use this to redirect the home page. For example:




$this->redirect(array('page/show', 'id'=>'1'));



config/main.php

may be change:

‘defaultController’=>‘site’ =>>> ‘defaultController’=>‘home’