Q:

Yii framework: Controller url & parameters

In my application I have "PController" with default action "actionIndex", so in Yii the path becomes p OR p/index.  Now in order to get certain users info I use the following path p/index?u=test where test is the username and u part of the path is basically a GET parameter (p/index?u=test). 
Is there any way to do the same thing without index?u= part of the path, i.e. I want my path to look like example.com/p/test ? 

A:

In your application config find section for components and add options for urlManager
array(
    ......
    'components' => array(
        ......
        'urlManager'=>array(
            'showScriptName' => false,
            'urlFormat' => 'path',
            'rules' => array(
                '/p/<u:\w+>'=>'p/index'
            ),
        ),
    ),
);

http://www.yiiframework.com/doc/guide/1.1/en/topics.url

