Show Only Params In Url: Url Rewriting

Hi Guys,

I have been trying the following rule to remove all three ‘module name’ ,‘controller’, ‘action’ and showing only params instead:

'/<country:\w+>/<trip:\w+>/<poi:\w+>' => 'module/detail/index/'

It works fine. But whenever url from other module like ‘other-module/controller/action’ is called, rule is activated. Is there anyway to implement the rule inside a module or for one module only?

Many thanks in advance

How will the system know, for which module, controller, and action should the url be rewritten - if you totally skip these?

IMO… you cannot plainly skip the module, controller and action - else you will face the problem like you have now.

An option could be to have a shorter but unique alias replacing each of them.


'm1/d1/<country:\w+>/<trip:\w+>/<poi:\w+>' => 'module1/detail1/index/'

'm2/d2/<country:\w+>/<trip:\w+>/<poi:\w+>' => 'module2/detail2/index/'

Thanks for the reply. It was helpful. I have one more query. Can we show the parameter names in url but not the parameter values? However, I should be able to get parameter values.