I am trying to create a set of url rules as follows:
[
'class' => 'yii\rest\UrlRule',
'tokens' => ['{id}' => '<id:(\w+)>'],
'controller' => [
'v1/items/<jid:(\w+)>/categories' => 'v1/itemcats',
],
],
and when accessing /v1/items/abc/categories i expect to have the index action show up, but it doesn’t, i get a 404 instead.
On the other hand, if i add following rule:
[
'class' => 'yii\web\UrlRule',
'pattern' => 'v1/items/<jid:(\w+)>/categories',
'route' => 'v1/itemcats',
'verb' => ['GET', 'HEAD'],
'mode' => \yii\web\UrlRule::PARSING_ONLY,
],
Then i can access the index action just fine.
Any idea about what’s happening here?