Go to ManagerController after login

I have 2 controllers,the site that it is the frontend and the manager that it is the backend.

How can I set the user after the login to go to the manager/index?

Now after login he goes at site/index

What does your login action look like?

First of all You must add Backend UrlManager in frontend config:




  'urlManagerBackend' => [

            'class' => 'yii\web\urlManager',

            'baseUrl' => '/app/backend/web',

            'enablePrettyUrl' => true,

            'showScriptName' => false,

        ],



Then after login make redirect:




$this->redirect(Yii::$app->urlManagerBackend->createUrl(['manager/index']));




I have the basic template and the login action is


public function actionLogin() {

        if (!Yii::$app->user->isGuest) {

            return $this->goHome();

        }


        $model = new LoginForm();

        if ($model->load(Yii::$app->request->post()) && $model->login()) {

            return $this->goBack();

        }

        return $this->render('login', [

                    'model' => $model,

        ]);

    }




return $this->goBack();



Looks like that’s the line you need to change.