If you type a URL like http://site.com/blog/blogblogyjr , where blogblogyir is a non-existent page of site.com/blog, instead of page 404 this appears: 
The NotFoundHttpException file itself is located: D: \ sites \ site \ yii2 \ vendor \ yiisoft \ yii2 \ web
code from BlogController.php (located in dir: D: \ sites \ site \ yii2 \ frontend \ controllers)
<?php namespace frontend\controllers; use common\models\Blog; use Yii; use yii\web\Controller; /** * Blog controller */ class BlogController extends Controller { /** * Displays homepage. * * @return mixed */ public function actionIndex() { #$blogs = Blog::find()->where(['status_id'=>1])->orderBy(['id' => SORT_DESC])->all(); $blogs = Blog::find()->andWhere(['status_id'=>1])->orderBy('sort')->all(); #$blogs = Blog::find()->where(['status_id'=>1])->orderBy(['id' => SORT_ASC])->all(); return $this->render('all',['blogs'=>$blogs]); } public function actionOne($url) { if($blog = Blog::find()->andWhere(['url'=>$url])->one()) { return $this->render('one',['blog'=>$blog]); } throw new NotFoundHttpException (); } } an instruction in BlogController helped - use yii \ web \ NotFoundHttpException; but how to make a post in BlogController throw earn new NotFoundHttpException ('oops, there is no such blog'); Now it just shows Not Found (# 404) page not found