BTW, If you prefix ‘/’ in the url and then change the rules it will change according to the new rules. So if you had a rule:
'dashboard' => 'site/dashboard/index'
And you created a rule using:
$this->createUrl('/dashboard');
Then it will redirect to ‘site/dashboard/index’ then when you change the rule from the above to something like
'dash' => 'site/dashboard/index'
if you used to create the rules like the above it will still generate ‘dashboard’ instead of the new ‘dash’ rule. So you need to create urls according to their paths, So when changing them they will automatically change in all places you used them.
'urlManager'=>array(
'showScriptName' => false, // do not show "index.php" in URLs
'urlFormat' => 'path', // use "path" format, e.g. "post/show/id/4" rather than "r=post/show&id=4"
'rules'=>array(
'reports' => 'reports/index',
'reports/<id:\d+>' => 'reports/show',
'images/cached/<folder:\d+>/<attachment:\d+>-<hash:\w+>-<transform:\w+>.jpg' => 'image/cache',
'<_c:\w+>/<_a:\w+>/<id:\d+>' => '<_c>/<_a>',
),
),
The ‘reports’ rule is a work-around - without it, I get ‘reports/index’ when I create the URL for controller/action ‘reports/index’.
You didn’t used to need this workaround in previous versions of Yii, as far as I know?
Perhaps there would be some way to write a general rule to emulate this behavior? Like maybe…
'<_c:\w+>' => '<_c>/index'
But that would work only for controllers where the default action is actually named "actionIndex", which is not always the case.
Just a note: From a quick look i saw that you should change the order of your reports, as the first matching rule will be used. So the order should be from more specific to more general: