2014-03-06 54 views
0

我已經實現了使用Yii框架的項目。網址管理工作正常,但。我需要更改URL文本。它可以在類別名稱後顯示域名。即我的項目URL是kitchenking.com。域名後我的類別名稱應顯示。yii框架中的url管理流程

ie kitchenking.com/Thanksgiving。但我的項目url顯示像這樣我顯示如下:

http://kitchenking.com/recipe/index1/name/Thanksgiving 

我做了我的配置文件顯示以下。請告訴我需要更改代碼的位置。

'Home'=>'site/index', 
      //'cuisine'=>'recipe/index3', 

          'cuisine/<name:\w+>/<id:\d+>/'=>'recipe/index3', 
      'holidays/<name:\w+>/<id:\d+>/'=>'recipe/index1', 
      'calories/<name:\w+>/<id:\d+>/'=>'recipe/index2', 
      'recipeshow/<name:\w+>/<id:\d+>/'=>'recipe/recipeshow',         
      //'recipeshow'=>'recipe/recipeshow', 
      'recipeshow/<name:\w+>/<id:\d+>/'=>'index.php/recipe/course', 

上面的代碼。我想要像這樣變化。配方/ INDEX3而不是美食, 食譜/索引2,而不是節假日,

回答

0

在UrlManager修改規則如下: -

'urlManager' => array(
    'rules' => array(
     'cuisine' => 'recipe/index3', 
     'holidays' => 'recipe/index3', 
    ) 
)