Question

My Yii app url format is domain/controller/function. I don't want to disclose the original controller name and function to user.The user should see only domain/foo/bar instead of original names.How can I achieve it?

Était-ce utile?

La solution

You can archive it by using url manager. Imagine you have a controller called "SampleController" with an action called "actionSampless", then you can have something like this:

'urlManager'=>array(
    'urlFormat'=>'path','showScriptName'=>false, 'caseSensitive'=>false,
    'rules'=>array(
    'test/test/*'=>'Sample/Sampless',
     //'pattern1'=>'route1', (it goes like this)
   ),
  ),

for more info click here. read User-friendly URLs topic..

Hope it will help you.

Autres conseils

inside the application configuration i.e in config/main.php

add the line to url rules

'foo/bar'=>'ur_controller_name/ur_action_name',
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top