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




<?php


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




http://localhost/myapp/frontend/test/



I got an error





Not Found


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




I also tried this




http://localhost/myapp/frontend/test/index



still won’t work. so how ?


http://localhost/myapp/frontend/web/test/

Make sure to enable pretty URLs for that to work.