-1

This is the original URL in my project

http://www.example.com/index.php?r=profile/publicProfile&name=CompanyName

But I want to rewrite the URL look like

http://www.example.com/CompanyName

And, I need to rewrite the URL only for above URL. No need to rewrite all URLs in the project.

4

1 回答 1

1

你应该阅读这个:http ://www.yiiframework.com/doc/guide/1.1/en/topics.url

Yii URL 管理非常方便,你应该尝试修改你的 urlManager 配置,例如:

'urlManager'=>array(
  'urlFormat'=>'path',
  'showScriptName'=>false,
  'rules'=>array(
    .....
    // AFTER other rules
    '<name>' => 'profile/publicProfile',

不要忘记创建一个.htaccess文件以在您的服务器上启用重写:http ://www.yiiframework.com/doc/guide/1.1/en/topics.url#hiding-x-23x

于 2013-05-28T10:03:39.583 回答