Cascading Routes


I was wondering if there is a way to cascade routes. For example I have these two:


‘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:

  1. define the routes in reversed order: from more specific to more common.

  2. 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’.