Urlmanager General Rule For Urls Like 'about/contacs'

Hello, dear community.

Today i have a specific problem: i’m trying to create the urlManager’s general rule for not-solved requests…

This is my urlManager configuration:




    'showScriptName' => false,






This is my rule in the end of the list:


and the SiteController’s action named actionPage:

public function actionPage($url)


    echo $url;


The trouble is urlManager don’t recognize urls with 2 pieces divided by slash:

/dsa/asd/asdasd/ – [color="#008000"]OK[/color]

/asdasd/ – [color="#008000"]OK[/color]

/asd-asd/ – [color="#008000"]OK[/color]

/asd/asd/ – [color="#FF0000"]404[/color]

Can anyone explain me the reason of that?

I have no chance to use this rule like ‘/site/asd/asd/’ because i need clear urls in my project, like ‘/about/contacts/’ or just only ‘/contacts/’, and for those static pages i use a separate controller.


Hehe, i’ve found a probably solution while i write this post :) So, the problem is my two rules make a conflict… and the new question is – how to befriend them together?

I wonder, why the first rule is not skipped because there is no controller AsdController with actionAsd in it? O_o

The rule is not skipped, because the url manager does not know which controllers/actions exists and which don’t. All it does it to resolve a URL to a route.

You could try to make the first rule more specific and list all available controllers so that it does not match the other request anymore. For example:

'<controller:(site|user|whatever)>/<action>' => '<controller>/<action>',

Another option is to add a prefix to your final rule, like

'static/<url>' => 'site/page'