Not able to resolve request

Hi All,

I am new to Yii2.

I am having a might be very silly problem. I am just creating a controller and an action.


<?php


namespace app\controllers;


use Yii;

use yii\web\Controller;


class PostController extends Controller

{

    public function actionIndex()

    {

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

    }

}

?>



But after this when I hit request like

http://localhost/basicyii2/web/index.php?r=post/index

It says "Page Not Found".

But at the same time

http://localhost/basicyii2/web/index.php?r=site/index

is working.

Any help for this situation, will be highly appreciated.

Thanks

What is the name of the file that contains the Postcontroller class?

Thanks Patrick for your response.

There is a typo in the File name. Its PostContoller instead of PostController.

Because you have not created folder post in folder views.

Check again folder structure:

basicyii2 > views > post > index.php

That’s just plain wrong. What you describe would result in a 500 and not in the 404 op mentioned.

[color="#006400"]/* Moved from "Tips" to "General Discussions" */[/color]

the filename of Postcontroller must be PostController.php.