Reputation: 623
I want to hide the action view from url I have passed a parameter title.The action view works perfectly but action index does not get executed instead a action view only get called.
Eg: if i request a/view/yii
it takes to view action, but when i call a/index
then also view action is called why so?
'a/<title:\w+>' => 'a/view',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
Upvotes: 0
Views: 83
Reputation: 4323
It is because /action/index
matches the template 'a/<title:\w+>'
you can add additional rule for this route before template:
'a' => 'a/index',
'a/<title:\w+>' => 'a/view',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
Upvotes: 1