tread
tread

Reputation: 11098

Yii Default Controller and Trying to Find matching controller route first?

Say I have 3 Controllers ShareController, IndexController and AjaxController

I set the IndexController as the DefaultController. But I would like /share to show the Index Action of Share instead of trying to find the share Action of IndexController

My current urlManager:

'rules'=>array(
          '<action:\w+>' => 'site/<action>',
          '<controller:\w+>/<id:\d+>'=>'<controller>/view',
          '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
          '<controller:\w+>/<action:\w+>'=>'<controller>/<action>'

Upvotes: 0

Views: 56

Answers (1)

hamed
hamed

Reputation: 8043

Add this rule inside your url-manager rules:

"share" => "share/index"

Upvotes: 1

Related Questions