Url Mapping

I have the following url manager rules …




'rules'=>array(

'/'=>'user/signin',

//'<controller:\w+>/<id:\d+>'=>'<controller>/view',

'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

'<controller:\w+>/<action:\w+>/<type:\d+>'=>'<controller>/<action>',

'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

),



This gives me nice urls like …

www.samplesite.com/people/create

etc.

I want to know how to map the "people" controller to another controller in the background.

So that I can specify "people" in the URL, as the controller, but it actually goes to another controller.

Hi JamesBarnsley

check ‘people/<action:\w+>/<id:\d+>’=>‘youranothercontroller/<action>’,

Hi,

Ok thanks, will check it out.

James.

Hi,

I have tried it but it does not work.

Any more ideas anyone?

James.

Please note I have tried …




'people/edit/'=>'user/edit',



And it works, but some reason the other one did not …




'people/<action:\w+>/<id:\d+>'=>'user/<action>',



Any ideas why? Or should it work?

You may try




'people/<action:\w+>'=>'user/<action>',



or both




'people/<action:\w+>/<id:\d+>'=>'user/<action>',

'people/<action:\w+>'=>'user/<action>',



Hi,

I tried this and it did not work …




'people/<action:\w+>/<id:\d+>'=>'user/<action>',



Is it suppose to work? Have you used it and it worked?

Because if so, there may be something else I am doing wrong?

I just to know whether you tried it and it worked.

Yes, it worked for me, but I tried with the Site controller.




'people/<action:\w+>'=>'site/<action>',



This definitely works for requests like ‘people/create’.

With the User controller must be the same thing. So could you remove all other rules

and try with a single




'people/<action:\w+>'=>'user/<action>',



Hi,

This now works for me …




'account/<action:\w+>/<id:\d+>'=>'user/<action>',

'account/<action:\w+>'=>'user/<action>',



But now I want to map two urls to one controller so I thought I would try this …




'account/<action:\w+>/<id:\d+>'=>'user/<action>',

'account/<action:\w+>'=>'user/<action>',

'account/<action:\w+>/<id:\d+>'=>'company/<action>',

'account/<action:\w+>'=>'company/<action>',



But it does not work, it only works for one of them, anyone have any ideas?

James.

Hi,

What you are actually trying to do is to map one url to two controllers. This definitely won’t work.

Could you give an example of urls and controllers that should be assigned to them without Yii rules syntax?