Reputation: 598
Sorry I am new bie and I am working friendly url in Yii framework.The index page is ok but when I input param for edit, the url is not friendly.
index page: http://localhost/news/news/index.html
edit page: http://localhost/news/news/edit/59.html
how can we hide the id param and have url like this:
http://localhost/news/news/edit.html
here is the config in main.php
'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>',
),
),
thankyou very much
Upvotes: 0
Views: 678
Reputation: 3332
You will have to attach some form of an identifier to the url to denote a unique record. If you want to do away with the ID,use a title or text to achieve the purpose making urls SEO friendly. Incase you are going that route, you will have to set up a custom url rule . Refer http://www.yiiframework.com/doc/guide/1.1/en/topics.url#using-custom-url-rule-classes for more info.
Upvotes: 1