CUrlManager splitted to 2 classes


When we try to extract an ID from an url-friendly ID (example: /post/32-do-you-like-bananas) we will use :

'rules' => array(

'<controller:\w+>/<id:\d+>\-.+' => '<controller>/<id>',

CUrlManager will extract ‘32’ as $id in :

public function actionPost($id) {

echo $id; // outputs 32


but in the same time, it will also create urls like :


That’s why i think Yii should enable 2 separated rules arrays.

One will be used for createUrl() and another one for parseUrl()


it was my rules syntax

i solved the problem

Would be nice if you can write here the rigth rule syntax… this would help if someone in the future comes to this thread with a similar problem.

Here is a portion of code that worked fine with the default URL manager:











Assuming you are creating URLs like :