Hi,
I was wondering if there is a way to cascade routes. For example I have these two:
‘<controller:\w+>/<action:\w+>’=>’<controller>/<action>’,
‘user/<userName>’ => ‘user/view’,
Is it possible to have Yii skip the first route if no matching action is found?
Thanks a lot!
There are at leat two ways:
-
define the routes in reversed order: from more specific to more common.
-
write your own URL rule class (1.1.8+)
Thanks a lot for the reply! I think i’ll need to go with the second way because if I place the specific rule (‘user/<userName>’ => ‘user/view’,) at top a call to /user/register will ttrigger the action view with a username ‘register’.