While I type localhost/yiitest
in the address bar I want to view the login page. I searched the web, but wasn't able to find out how to do this.
Can anybody help me?
While I type localhost/yiitest
in the address bar I want to view the login page. I searched the web, but wasn't able to find out how to do this.
Can anybody help me?
If youre using yii1, add a filter to your controller:
public function filters()
{
return array('accessControl'); // perform access control for CRUD operations
}
public function accessRules()
{
return array(
array(
'allow', // allow authenticated users to access all actions
'users'=>array('@'),
),
array('deny'),
);
}
If not logged user try to access any page, he will be redirected to site/login
(you can change it in config). Of course if u add this accessRules in SiteController
you have to add additional rule to allow not logged in users to access actionLogin()
.