Invalid CUrlManager matching


I have next rules for CUrlManager:

            'rules' => array(

1:                //'estate/viewQuickInfo/id/<id:\d+>' => array('estate/viewQuickInfo'),

2:                '<estateTypeUrlTitle>/<cityUrlTitle>/<title>/<id:\d+>' => array('estate/view'),

3:                'estate/<title>/<id:\d+>' => 'estate/view',


As i understood second rule should manage only urls with estateTypeUrlTitle, cityUrlTitle params:

    <?php echo CHtml::link(

        $data->getCaption(), array(


            'estateTypeUrlTitle' => $data->type->urlTitle,

            'cityUrlTitle' => $data->city->urlTitle,

            'id' => $data->id,

            'title' => $data->urlTitle,

        ), array('class' => 'location'));


but current rules also manage any link with id. For example: !!!!!!!!!!

show same page, like

Then i uncomment rule 1 i have valid result for link, but i think it is invalid to add rule for each other controllers/action just so they will retain work?

Is it possible to do so second rule works only for URLs with estateTypeUrlTitle, cityUrlTitle params?


Hi slyder,

in you have this rule:

'<estateTypeUrlTitle>/<cityUrlTitle>/<title>/<id:\d+>' => array('estate/view'),

and url like:

This means, that always controller Estate and action View will be requested.

If you just need to call controller/action/id/5, you don’t need rules.

Just set urlFormat to path, showScriptName to false and CUrlManager will do the rest.

Will call controller Estate, action Delete with get parameter ID = 5.

For this kind of URLs, rules are not needed.

If you want some custom URLs, like:

so then you need this rule:

'contacts' => 'site/contact', //controller Site, action Contact


CHtml::link('Contacts', array('site/contacts'));

or another example:

'contacts/<title>' => 'site/contact', //controller Site, action Contact


CHtml::link('Contacts', array('site/contacts', 'title' => 'Sales'));

This will output:

And in controller site, action contacts you will know, that contact form should be for Sales team ($_GET[‘title’] == ‘Sales’)…