Question about urlManager

I read guide to url manager. I have question is it possible to create rule for example:

‘about_us’ => ‘site/pages’ and add constant id to GET parameters for example would be equal to

Everything’s possible with Yii :D

'about_us' => array('site/pages', 'defaultParams' => array('id' => 4)),

o thx :) i don’t know how i missed it :)

but i have another problem with it, is it possible to do something like this

‘about_us’ => array(‘site/pages’, ‘defaultParams’ => array(‘id’ => 4)),

‘our_partners’ => array(‘site/pages’, ‘defaultParams’ => array(‘id’ => 5)),

because when i do something like that all URLs look like this

about_us?id=3,about_us?id=4 :(.

Try this property:

But in this situation I recommend you to create different actions "AboutUs", "OurPartners" etc.

Predicting your question about what to do, if you have many actions like AboutUs and OurPartners (too much rules and methods to write), I want to suggest a technique:

In UrlManager make a rule:


// or even a rule like this:


Then in SiteController define a method missingAction:

public function missingAction($actionId)


    switch ($actionId)


        case 'about_us':  ...

        case 'our_partners':  ...


        default: // you can redirect or throw an exception there or call parent::missingAction($actionId).



Thx for help that is good idea :). I didn’t know missingAction function.