Can we display url in the format controller/action/id to /id in Yii? Also, one major problem is that I need to do this only on the specific controller/
In my opinion you can not map one customized URL to two or more URL path or action. Like when someone access /my_username the will be redirected to /user/post/ujjwal or /image/display/ujjwal. The application will be confused because of this pattern/rules.
So I recommend you to change the /image/display/ujjwal to another pattern/rules. Like /my_username/image
I use username as the query string for selected username.
'components'=>array(
.....
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
''=>'user/post',
'/display'=>'image/display',
'/'=>'/view',
'//'=>'/',
'/'=>'/',
),
),
....
Someone has asked this similar question before: How to specify a SEO friendly url like twitter www.twitter.com/