how to run controller under frontend ?

Hello ,

So I created a TestController file inside the frontend/controllers directory and then created a view/test directory with an index.php file inside it. my code for the TestController is this


namespace app\frontend\controllers;

use yii\web\Controller;

class TestController extends Controller{


    public function actionTest(){

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





my index file only contains an echo of hello world.

my question now is, how to run this in the browser ?

I tried in the url


I got an error

Not Found

The requested URL /myapp/frontend/test/ was not found on this server.

I also tried this


still won’t work. so how ?


Make sure to enable pretty URLs for that to work.