Get Url Route When Urlformat Is `path`


I want to get the route of a URL, when CUrlManager::$urlFormat is set to "path".

Assume I have created a URL like this:

$url = Yii::app()->createUrl('controller/action', array('id' => 123));

which will generate this: controller/action/id/123. Now I want to do the reverse action and get the route of the URL, which is controller/action.

How can I do that?

Thank you.

Dear Friend

Kindly check the following when urlFormat is path.

echo Yii::app()->urlManager->parseUrl(Yii::app()->request);


I checked it and it does not work for me. In fact, it does return the GET params; as documentations say:

I need to separate the route form GET params.