title: how to redirect error action in yii2?
body: <p>i have to config common/main.php file in error handler but, not redirect error action. so please help me in this error.</p>
  
  <p>main.php</p>
  
  <pre><code>'components' =&gt; [
  .......
  'errorHandler' =&gt; [
              'errorAction' =&gt; 'site/error',
          ],
  .......
  ],
  </code></pre>
  
  <p>SiteController.php</p>
  
  <pre><code> &lt;?php
  namespace backend\controllers;
  
  use Yii;
  //use yii\web\Controller;
  use common\models\LoginForm;
  use common\models\EmailTemplate;
  use backend\components\BackendController;
  use common\models\Users;
  
  //use common\components\Helpers;
  /**
   * Site controller
   */
  class SiteController extends BackendController
  {
      /**
       * @inheritdoc
       */
  
      public function beforeAction($event)
      {
          //print "before action";exit;
          return parent::beforeAction($event);
      }
  
      /**
       * @inheritdoc
       */
      public function actions()
      {
          return [
              'error' =&gt; [
                  'class' =&gt; 'yii\web\ErrorAction',
              ],
          ];
      }
  
      public function actionError(){
          print "Here: Error Action";exit;
      }
  
      public function actionIndex()
      {
          if(empty(Yii::$app-&gt;session['admin_user_id'])){
              return $this-&gt;redirect(['site/login']);
          }
          // Yii::$app-&gt;Helpers-&gt;getSettings('test');
          return $this-&gt;render('index');
      }
  
  
  }
  </code></pre>
  
  <h1>Error Output:</h1>
  
  <pre><code>An Error occurred while handling another error:
  exception 'yii\web\NotFoundHttpException' with message 'Your request not found.' in F:\xampp\htdocs\school\backend\components\BackendController.php:52
  Stack trace:
  #0 F:\xampp\htdocs\school\backend\components\BackendController.php(25): backend\components\BackendController-&gt;checkpermission()
  #1 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Object.php(107): backend\components\BackendController-&gt;init()
  #2 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Controller.php(81): yii\base\Object-&gt;__construct(Array)
  #3 [internal function]: yii\base\Controller-&gt;__construct('site', Object(yii\web\Application), Array)
  #4 F:\xampp\htdocs\school\vendor\yiisoft\yii2\di\Container.php(366): ReflectionClass-&gt;newInstanceArgs(Array)
  #5 F:\xampp\htdocs\school\vendor\yiisoft\yii2\di\Container.php(151): yii\di\Container-&gt;build('backend\\control...', Array, Array)
  #6 F:\xampp\htdocs\school\vendor\yiisoft\yii2\BaseYii.php(340): yii\di\Container-&gt;get('backend\\control...', Array)
  #7 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Module.php(568): yii\BaseYii::createObject('backend\\control...', Array)
  #8 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Module.php(521): yii\base\Module-&gt;createControllerByID('site')
  #9 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Module.php(449): yii\base\Module-&gt;createController('site/error')
  #10 F:\xampp\htdocs\school\vendor\yiisoft\yii2\web\ErrorHandler.php(80): yii\base\Module-&gt;runAction('site/error')
  #11 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\ErrorHandler.php(101): yii\web\ErrorHandler-&gt;renderException(Object(yii\web\NotFoundHttpException))
  #12 [internal function]: yii\base\ErrorHandler-&gt;handleException(Object(yii\web\NotFoundHttpException))
  #13 {main}
  Previous exception:
  exception 'yii\web\NotFoundHttpException' with message 'Your request not found.' in F:\xampp\htdocs\school\backend\components\BackendController.php:52
  Stack trace:
  #0 F:\xampp\htdocs\school\backend\components\BackendController.php(25): backend\components\BackendController-&gt;checkpermission()
  #1 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Object.php(107): backend\components\BackendController-&gt;init()
  #2 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Controller.php(81): yii\base\Object-&gt;__construct(Array)
  #3 [internal function]: yii\base\Controller-&gt;__construct('teacher', Object(yii\web\Application), Array)
  #4 F:\xampp\htdocs\school\vendor\yiisoft\yii2\di\Container.php(366): ReflectionClass-&gt;newInstanceArgs(Array)
  #5 F:\xampp\htdocs\school\vendor\yiisoft\yii2\di\Container.php(151): yii\di\Container-&gt;build('backend\\control...', Array, Array)
  #6 F:\xampp\htdocs\school\vendor\yiisoft\yii2\BaseYii.php(340): yii\di\Container-&gt;get('backend\\control...', Array)
  #7 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Module.php(568): yii\BaseYii::createObject('backend\\control...', Array)
  #8 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Module.php(521): yii\base\Module-&gt;createControllerByID('teacher')
  #9 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Module.php(449): yii\base\Module-&gt;createController('teacher/index')
  #10 F:\xampp\htdocs\school\vendor\yiisoft\yii2\web\Application.php(84): yii\base\Module-&gt;runAction('teacher/index', Array)
  #11 F:\xampp\htdocs\school\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application-&gt;handleRequest(Object(yii\web\Request))
  #12 F:\xampp\htdocs\school\backend\web\index.php(19): yii\base\Application-&gt;run()
  #13 {main}
  </code></pre>
  
  <p>any error found or throw error on show above output.
  please help me</p>