Hi !
Is there a way to hide ONE controller in the URL ?
I have several controllers, for example :
[font="Courier New"]
http://website/controller1/action/args
http://website/controller2/action/args
http://website/controller3/action/args
…
[/font]
I would like to use http://website/args instead of http://website/controller1/action/args
And I would like to be able to use the other controllers http://website/controller2/action/args & http://website/controller3/action/args
I have tried several things and looked for it in the forum without any success.
Thank you !
Y11
(Y!!)
2
You can setup url rules the way you like, see here under User-friendly URLs.
You may do this:
'rules' => array(
'something' => 'controller1/index',
'controller2/<someId:[0-9]+>' => 'controller2/index',
),
Then you can access thru:
http://example.com/something
http://example.com/controller2/123
sajibcse
(Sajib Cse03)
4
Hi,
I’m new in Yii.
I would like index.php/businessAccount/index/city/CA/business/Shop To index.php/CA/Shop.html
I’m trying to use those :
'rules'=>array(
'<city:\w+>/<business:\w+>' => array('businessAccount/index', 'caseSensitive'=>false, 'urlSuffix'=>'.html',),
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
But It did not work . But if you use:
'rules'=>array(
'<city:\w+>//<business:\w+>' => array('businessAccount/index', 'caseSensitive'=>false, 'urlSuffix'=>'.html',),
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
then it work but url is :index.php/CA//Shop.html
Please give a suggestion how can i solve it…
Thanks & Regards,