Hello Yii!
I’ve been trying to make my url more clean. What I have is:
site/projects/projects/id/3.html
or
site/projects/projects/update/id/3.html when i am updating…
I need to show the title of my project, not the id. Like that, only showing the module and the title:
site/projects/title.html
This is my actual code:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'urlSuffix'=>'.html',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
I tried many things like changing ‘d’ for ‘w’ and also ‘id’ for ‘name’ as i read in others posts, but nothing works.
This are other things that i tried:
'rules'=>array(
'<_c:(projects)>/<_a:(create|update|delete)>/<id:\d+>' => '<_c>/<_a>',
'<_c:(projects)>/view/' => '<_c>/<_a>',
'<_c:(projects)>/<id:\d+>' => '<_c>/read',
'<_c:(projects)>s' => '<_c>/list',
)
//also using modules rules, i have this site/projects/projects/id/3.html:
'rules'=>array(
'<module:\w+>/<controller:\w+>/view/<id:\w+>'=>'<module>/<controller>/<title:\w+>',
'<module:\w+>/<controller:\w+>/<action:\w+>/<id:\w+>'=>'<module>/<controller>/<action>',
'<module:\w+>/<controller:\w+>/<action:\w+>'=>'<module>/<controller>/<action>',
I am lose, what can i do?
Thanks everyone for your time…!!!