UrlManager Rules: delete "site" from the url

Hi everybody,

I would like to delete the "site" string from the url. I tried with this rule:




'<action:.*>'=>'site/<action>'



It works until I call the “site” actions. When I call an action of another controller, it doesn’t work anymore.

If I use this code:




$this->createAbsoluteUrl('secondcontroller/action')



the framework process the request like if the "secondcontroller" was an "action" of the "site" controller.

How can I solve?

Thanks.

Anybody?

by writing ‘<action:.*>’ all requests will go to site controller

The right way would be <action:(index|login|logout)> etc.

If that rule above is the only one you have… then all your links will use that rule to make the URL…

So for other controllers you need to add some rules… :D

Thanks for the reply, I solve using these rules:




'secondcontroller/<action:.*>'=>'secondcontroller/<action>',

'<action:.*>'=>'site/<action>',



anyway I sould add rule for all new controllers.

you have so many actions you cant list them (link in my example above)?

to many route rules is bad

I don’t have so many actions, it’s another solution. Actually I use yours. Thanks.