Tell me how to make your error page in yii2. Created view error.php in views / site. Registered in the controller
public function actionError() { $this->render('error'); } In config / web.php
'errorHandler' => [ 'errorAction' => 'site/error', ] But when you call
throw new \yii\web\HttpException(404 ,'Страница не найдена'); redirection to the error page does not occur, the browser error page is displayed.