Hide controller in the URL

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 !

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

Thank you Y!!

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'=&gt;array(





        	'&lt;city:&#092;w+&gt;/&lt;business:&#092;w+&gt;' =&gt; array('businessAccount/index', 'caseSensitive'=&gt;false, 'urlSuffix'=&gt;'.html',),





        	'&lt;controller:&#092;w+&gt;/&lt;id:&#092;d+&gt;'=&gt;'&lt;controller&gt;/view',


			'&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;/&lt;id:&#092;d+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;',


			'&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;',


		),

But It did not work . But if you use:

		'rules'=&gt;array(





        	'&lt;city:&#092;w+&gt;//&lt;business:&#092;w+&gt;' =&gt; array('businessAccount/index', 'caseSensitive'=&gt;false, 'urlSuffix'=&gt;'.html',),





        	'&lt;controller:&#092;w+&gt;/&lt;id:&#092;d+&gt;'=&gt;'&lt;controller&gt;/view',


			'&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;/&lt;id:&#092;d+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;',


			'&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;',


		),

then it work but url is :index.php/CA//Shop.html

Please give a suggestion how can i solve it…

Thanks & Regards,