controller not found problem

I created a controller via gii and when I tried to see it at IE I have the error Not Found (#404)

What is wrong. The url I tried is bellow, Blog is the controller


I managed to solve it setting below code at web.php.I have to do it each time I am creating a controller?

'controllerMap' => [

        'blog' => 'app\controllers\BlogController',


You can access generated controllers by controller name. The controller name is the word before Controller on filename or class name. Yii is case sensitive, so if controller name is camelcased, the correct url is all in lowercase.


BlogController as blog

BlogPagesController as blog-pages

Without the controllerMap rule I have the page not found error. May I missed something?


namespace app\Controllers;

use Yii;

use yii\web\Controller;

class BlogController extends Controller {


     * @inheritdoc


    public function actions() {

        return [

            'error' => [

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




    public function actionIndex() {

      return $this->render('index');




I managed to solve it. The error was the capital C at controllers below!

namespace app\Controllers;

Life saver - this was driving me nuts, I can only think that I accidentally typed a capital into gii but it was very hard to understand what on earth was happening.