friendly url : do i need to list all controllers in config ?

Hi

I am just installed yii and trying to create a simple testing on it. I have a question regarding to friendly url in YII … then I read this documentation

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

one thing that I would to ask, should I list all my controllers in the config file ?

i would like all the controller to be accessible like :

www.mywebsite.com/yiidir/myController/myAction/myID?params1=1&params2=2 etc

kind of like that …

how to setup that in yii ?

I don’t like to list all my controllers inside config file … is it possible with YII ?

thank you !!

Seems like you want to utilize Parameterized Routes.

By default you’ll have url’s like user/show/id/123 and post/show/id/123. You can do a general rewrite of these url’s with:




'urlManager' => array(

  'rules' => array(

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

  ),

),



or if you find out it’s better to declare which controllers that should be affected:




'urlManager' => array(

  'rules' => array(

    '<controller:(user|post)>/<id:\d+>' => '<controller>/show',

  ),

),



thank you for the reply,

is the first one can be override with other rules ?

like if i add something like this :

"post/all" => "post/list"

if it is not for all "action" should I change into this ?

‘<controller:\w+>/<action:\w+>/<id:\d+>’ => ‘<controller>/<action>/<id>’,