I would like have all routes except the api routes to navigate to the site/index route but all /api path to be executed to the respective modules. I have added the following route rules
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
//api module
'api/<controller:\w+>/<action:[\w\-]+>' => '<controller>/<action>',
'api/<controller:\w+>' => 'api/<controller>',
//all other paths
'<controller:[\w\-]+>/<action:[\w\-]+>' => 'site/index',
'<controller:[\w\-]+>/' => 'site/index',
],
],
The following works for 2 level url routes that is
/users/create
/users/view
But when i access routes with more than 2 paths like
/users/create/12
/admin/uom/create/new
The routes are not redirrected to site/index
What else do i need to add to ensure that all routes even with more than 3 paths are executed via site/index but those with api prefix are executed via controller/action
or /api/controller
.
What am i missing out?