-1

I want to know if is possible using $this->redirect() statement ,to redirect to a different controller but without showing the action , I mean, if i want to redirect to controller Person by default yii goes to Person/index, I want to redirect to Person (don't want to show the action Person == Person/index)

I know that with $this->redirect() I can use $this->redirect(array(controller/action)), but is always showing the index action.

Alfred Wallace
  • 1,741
  • 1
  • 14
  • 32
General Electric
  • 1,176
  • 3
  • 21
  • 44

1 Answers1

2

In your main.php, you should have these default rules in urlManager section:

'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',

Simply add this above the existing rules:

'<controller:\w+>/' => '<controller>/index',
Samuel Liew
  • 76,741
  • 107
  • 159
  • 260