Nested Controllers issue

I’m using nested controllers like:




I can then access them by:





How do I tell Yii, that if I ommit the final controller, that by default I want ‘index’? In other words, I want to do


I am using in my config:

'defaultController' => 'index',

It works for top level controllers but not nested ones.

I think i got it!

            '<controller1:\w+>/<controller2:\w+>/<controller3:\w+>/' => array('<controller1>/<controller2>/<controller3>/index', 'caseSensitive'=>false),

            '<controller1:\w+>/<controller2:\w+>/<action:\w+>.php' => array('<controller1>/<controller2>/index/<action>', 'caseSensitive'=>false),

            '<controller1:\w+>/<controller2:\w+>/' => array('<controller1>/<controller2>/index', 'caseSensitive'=>false),

            '<controller:\w+>/<action:\w+>.php' => array('<controller>/index/<action>', 'caseSensitive'=>false),

            '<controller:\w+>' => array('<controller>/index', 'caseSensitive'=>false),

            '<action:\w+>.php' => array('index/<action>', 'caseSensitive'=>false),

Yii doesn’t support nested controllers.

You should, instead, use modules.

What do you mean? I have them nested and working fine.

You’ll have issues with your setup, use modules instead, their usage is for your purpose.

Also, learn to format your url rules, the .html in the rule shouldn’t be there, see : and