response redirect doesn't go to url

Hi

I made a basic app with Yii2 and then uploaded it on a webhost. Then to remove web folder from address, move everything one level upper. Now in public_html I have everything has been in web folder before and other folders are outside of public_html.

My problem is redirect doesn’t work totally. Even in such a simple situation:




<?php


namespace app\modules\newsletter\controllers;


use Yii;

use yii\web\Controller;

use yii\web\NotFoundHttpException;


class TestController extends Controller

{

    public function actionIndex()

    {

echo 'Hi';

return $this->redirect(I TESTED MANY URLS);

    }


}



I can see ‘Hi’ but redirect doesn’t occur. I checked the


Yii::$app->response->i_sent

and that is true after redirect!

For your issue, you have to use following syntax:

For calling known controller’s action:


return $this->redirect(['controller/action']);

For any static URL (not use square brackets):


return $this->redirect('http://www.google.com/');

Hope this helps you. Let me know incase of any query/concern regarding the same.

Thanks!

I have the same problem. I tried with return and Brackets Sintaxis but nothing, everything is equal