Custom url to controller


I want make a customer url rule for my controller "register".

I want that all actions of this controller go to "cadastro".


Instead of "/register", show "/cadastro".

Instead of "/register/success", show "/cadastro/success".

I try make the following rule:

‘/cadastro/’ => '/register/

But doesnt work.

I try make the other following rule:

‘/cadastro/<_a>’ => ‘/register/<_a>’

All actions works fine, but if i create a url with only the controller name, it doesnt wortk example:

$this->createUrl(’/register/success’) ==> /cadastro/success (WORKS FINE)

$this->createUrl(’/register’) ==> /register (DOESNT WORKS)

You need to add several rules not just 1:

‘/cadastro/’ => '/register/

‘/cadastro/<_a>’ => ‘/register/<_a>’

‘/cadastro/<_a>/*’ => ‘/register/<_a>’

and maybe others… why dont you just rename the controller? :P

With multiple rules i know that works.

I want know if i can do with only one :(

But thanks man.

I dont rename the controller because all my application was built in english and i want that only some controllers have portuguese name on url but only for rute, my classes have to have english name.


you are defining a url rules in config file its good thing…but you can not create a url like only with a controller name…because in that case url rules manager will be confused that to which action you have to go with that Url…so it not an good approach to for this kind of url.

if you really want to display you url like that formate. then you just need to define a proper url rule for that…but you should right a proper syntex for create url in your controller like…("cotroller/action") then you can access with only controller name…with the help of url rules…!!!