Search code examples
yii2yii2-advanced-app

Route to action in module


I have moule admin and controller:
backend/modules/admin/controllers/DefaultController.php

 public function actionIndex()
    {
        return $this->render('index');
    }

 public function actionTest()
    {
        echo "test";
    }

Action index called successfully: : http://backend/admin

Action test return 404


Solution

  • You need to access the action as app/module/controller/action so that makes a url like backend/admin/default/test as your controller name is default and not test. Change it and it will work.