URL Manager, what rule to prepend "module" for modules path?

Hello everybody,

I need to set url rule like this:

before beautify : www.xxx.com/index.php?r=mymodule/mycontroller/default/

after beautify : www.xxx.com/module/mymodule/mycontroller/default

Is that possible? If not, is there any workaround?

I am trying using <module> but seems like Yii not recognize this…

Thank you…

Its only relevant which is the name of the variable you use inside <variable> so you can use it later as $_GET[‘variable’]

to do what you said use something like




'rules'=>array(

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

//now do the following just so you see what I meant

'module/<m:\w+>/<c:\w+>/<a:\w+>'=>'<m>/<c>/<a>',

)



and that is it

Thank you very much Gustavo… :)

I understand the concept now… and it’s work!

Glad I could help, Jun

By the way, you can use these variable you set inside <var> by doing later $_GET[‘var’], its useful many times, to for example, get an id setting rules like




'<c:\w+>/<a:\w+>/<id:\d+>'=>'<c>/<a>',

'<c:\w+>/<a:\w+>/<id:\d+>-<title:\w+>'=>'<c>/<a>',

'<c:\w+>/<id:\d+>-<title:\w+>'=>'<c>',

//and in your app

//url will be myController/myAction/12-myTitle

echo $_GET['id'];

echo $_GET['title'];



Hai Gust,

This is Nishanth,

I followed your steps to access module through Url Mangaer. But I could not access an action in from a mmodule.

but index action is loaded. Please suggest.