Reputation: 138
I have been trying the following rule to remove all three 'module name' ,'controller', 'action' and showing only params instead, in yii:
'/<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
Upvotes: 0
Views: 79
Reputation: 110
I think you need to use some static string in the URL to distinguish it in that case. Dynamic URL will cause the issue, it will not allow you to call a particular module keeping the same structure.
You can either prefix or postfix any custom static string.
I hope that helps.
Upvotes: 1
Reputation: 8950
Your url rule is too broad and could apply to a lot of url path.
For me the best way to solve the problem would be to create a custom url rule class that check if the <country:\w+>
is matching a country name (it could be matching one from an array or from your db if you have a table with all the countries).
Check the yii guide, they are kind of doing the same with cars brands
Upvotes: 1