2015-07-12 66 views
0

無論如何在一個配置文件中定義頁面URL並使其更友好。 例如在一個配置文件中定義頁面URL YII

/index.php/randomuser/default/index => randomuser 
/index.php/randomuser/default/view => randomuserview 
/index.php/useroftheday/default/index => useroftheday 
/index.php/useroftheday/default/view => userofthedayview 

回答

0

只是在這樣的配置文件來配置你的地址經理 -

'urlManager'=>array(
    'urlFormat'=>'path', 
    'showScriptName'=>false, 
    'rules'=>array(
     'randomuser'=> 'randomuser/default/index', 
     'randomuserview'=> 'randomuser/default/view', 
     'useroftheday'=> 'useroftheday/default/index', 
     'userofthedayview'=> 'useroftheday/default/view' 
    ) 
) 

新網址將是 - http://domain.com/randomuser