i new yii framework.i have page controller , contact_us action url become site_url/page/contact_us want should site_url/contact_us. want know how set route , in file.
class pagecontroller extends sitecontroller { function actioncontact_us() { //something ; } }
i m using code :-
'urlmanager'=>array( 'urlformat'=>'path', 'showscriptname'=>false, 'appendparams' => false, 'casesensitive'=>false, 'rules'=>array( array( 'class' => 'application.components.indexurlrule', 'connectionid' => 'db', ), array( 'contact_us' => 'site/page/contact_us', ), array( 'class' => 'application.components.pageurlrule', 'connectionid' => 'db', ), '<_c:index|trade|page>'=>'<_c>/index', 'page/<page_id:\d+>' => 'page/show' ), ),
you need configure in url manager in config file -
'urlmanager'=>array( 'urlformat'=>'path', 'showscriptname'=>false, 'rules'=>array( 'contact_us'=> 'site/page/contact_us', ) )
after url -
www.example.com/contact_us
Comments
Post a Comment