Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change default page in yii

Tags:

php

yii

I'm fairly new to yii, would like to know how to change the default page pra that instead of going to the index is directed to a page comingsoon I have.

Thanks for your time.

like image 402
josemm1790 Avatar asked Feb 22 '13 16:02

josemm1790


2 Answers

You can create a new controller with it's own view: comingsoon (see http://www.yiiframework.com/doc/guide/1.1/en/topics.gii).

Add this in: protected\config\main.php

'defaultController' => 'comingsoon', 
like image 109
danielpopa Avatar answered Oct 31 '22 16:10

danielpopa


Method 1: Change view page rendered in SiteController.php's index action:

public function actionIndex() {
    $this->render('index'); // change to "comingsoon"
}

Method 2: Let 404 error page display a coming soon message.

Method 3: Redirect to error page using URL manager rules in main.php:

'urlManager' => array(
    'rules' => array(
        'index'=>'site/index', // change "site/index" to "site/comingsoon"
        ...

Method 4: .htaccess rewrite.

like image 21
Samuel Liew Avatar answered Oct 31 '22 14:10

Samuel Liew