YII_DEBUG false redirect

Hi, I have a problem, if YII_DEBUG is true this run good but this is false not.


  defined('YII_DEBUG') or define('YII_DEBUG', false);




   public function actions()


            $Control=new Control;



                return $this->redirect(['/login/index']);


            $this->layout = 'main';   


        return [

            'error' => [

                'class' => 'yii\web\ErrorAction',


            'captcha' => [

                'class' => 'yii\captcha\CaptchaAction',

                'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,




If yii debug is true correct redirect but if is false the web page is white and code 500

CheckControl is a function that check if is guest

The problem is when the user lost session or if I destroy session(only this case).