Forward to "internal" controllers


Is it possible to do something like this:


public function actionPage(){

    if (isset($_POST['LoginModel'])) {

        $this->forward('/page/Account/Login', false);




public function actionLogin(){

    //login code


But without having the AccountController methods (/page/Account/Login) directly web accessible? I.e. so the actions work but are internal to Yii only.


You could configure urlManager to handle page/page to account/login

Hmm not sure that will work. I want to continue running additional code in actionPage() after actionLogin() has run.

yes you can, the forward function will allow you process another controller to be able work inside that action.


public function actionTest()


            echo 'Test';



        public function actionTest2()


            echo 'A<BR>';

            $this->forward('site/test', false);

            echo '<br>B';


this will get result: