Hello,
Redirect not working if exit; used after redirect. If i removed exit then i will work. Why it is not working with exit?
public function actionRd() {
$this->redirect("http://stackoverflow.com");
exit;
}
Hello,
Redirect not working if exit; used after redirect. If i removed exit then i will work. Why it is not working with exit?
public function actionRd() {
$this->redirect("http://stackoverflow.com");
exit;
}
Try
public function actionRd()
{
return $this->redirect("http://stackoverflow.com");
}
Hi Bizley,
I know that this is working but why it is not working when i put exit after $this->redirect() call.
Because without return this method does not send any headers to the browser. You need to call
Yii::$app->getResponse()->send()
in this case.