Confused about URL rules

Hey guys,

I am looking to implement a RESTful controller. I have been following along with this tutorial :

However, I am trying to use a slightly different directory structure :








and I have the following code:

'urlManager' => [

    'enablePrettyUrl' => true,

    'enableStrictParsing' => true,

    'showScriptName' => false,

    'rules' => [

        ['class' => 'yii\rest\UrlRule', 'controller' => 'user'], // <---- I feel like this is what I should be changing, but I want to make sure I am doing this right.



I assume ‘user’ points to the controllers folder by default, can i say ‘frontend\api\controllers\userapi’? (the file is named UserApiController.php)

I appreciate any time spent reviewing this, I really hope I made sense. I will clarify further if needed.


UserApiController -> /user-api

If you don’t need special url rules, you can omit ‘rules’ attribute.

That did it, Thanks!