I have following structure in the controllers directory :
- controllers
- TestController
- folder
- TestController
- folder
- TestController (ERROR)
- folder
- TestController
- folder
- TestController
Well, calling a custom action of the TestController in the second folder, the default action is called instead, and if none is defined, the “#404 not found error” is raised. But this happens only on the controllers in the second folder, while it works fine on all other controllers. So, if in all controllers an helloAction is defined, calling this action in the different controllers, causes different behaviours:
test/hello.html > OK
folder/test/hello.html > OK
folder/folder/test/hello.html > **ERROR**
folder/folder/folder/test/hello.html > OK
folder/folder/folder/folder/test/hello.html > OK
folder/folder/folder/folder/folder/test/hello.html > OK
folder/folder/folder/folder/folder/folder/test/hello.html > OK
I tried up to the sixth level and it works always except on the second level. I think it can depend only on the urlmanager rules, that I still don’t understand very well. These are my UrlManager settings:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'suffix' => '.html',
'rules' => require(__DIR__ . '/routes.php'),
],
and these are my rules:
'<controller:[\w-]+>/<id:\d+>' => '<controller>/view',
'<controller:[\w-]+>/<folder:[\w-]+>/<action:[\w-]+>/<id:\d+>' => '<controller>/<folder>/<action>',
'<controller:[\w-]+>/<action:[\w-]+>/<id:\d+>' => '<controller>/<action>',
'<controller:[\w-]+>/<folder:[\w-]+>/<action:[\w-]+>/<text:\w+>' => '<controller>/<folder>/<action>',
'<controller:[\w-]+>/<action:[\w-]+>/<text:\d+>' => '<controller>/<action>',
'<controller:[\w-]+>/<action:[\w-]+>' => '<controller>/<action>',
Thank you