How to redirect to previous URL in YII

If you want to get previous URL use blow line of code

echo Yii::app()->request->urlReferrer;

If you want to redirect to the previous URL use blow line of code

$this->redirect(Yii::app()->request->urlReferrer);

That’s it happy coding

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

DMCA.com Protection Status