yii url manager. urls in path format

url-routing, yii

Solution

Change the order of rules and remove `<help>`. It will be automatically added to action. So your rules should look like this:

'<controller:\w+>/<action:\w+>/<help:\w+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',

Order of rules matters. You need to put the most detailed one first.

Regards

Problem

I've been developing web application based on Yii framework. I've faced with troubles on trying to make sef urls. What I have: config is set up. 'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>false, 'rules'=>array( // rules go here ) ) This is code which is used for tesing: `echo $this->createUrl('site/test', array('help'=>'me')` `$this` - is controller. If I'm living 'rules' array in config empty I'm getting this `/site/test/help/me`. I expected this. If ``` 'rules'=>array( '<controller:\w+>/<action:\w+>' => '<controller>/<action>', ) ``` I'm getting `/site/test?help=me` which is also expected. But if ``` 'rules'=>array( '<controller:\w+>/<action:\w+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>/<help:\w+>' => '<controller>/<action>/<help>', ) ``` I'm still getting `/site/test?help=me`. I expected to see `/site/test/me` Could anyone help me? Thanks in advance.

Original source