In my admin controller action I want to redirect to the previous page. How can I do this?
2 Answers
Try this:
$this->_redirectReferer();
it does a little more than redirect to the previous page.
If you specify in the url a parameter uenc
it will consider that as the referrer.
-
Thanks it worked properly as I expected. And I went through the function where located in
Mage_Core_Controller_Varien_Action
. I think Mahmood Rehman's answer contains the development which has been done through this_redirectReferer()
function. Commented Nov 1, 2013 at 10:01
Try this code :
Mage::app()->getResponse()->setRedirect($_SERVER['HTTP_REFERER']);
Mage::app()->getResponse()->sendResponse();
exit;
-
This worked perfectly. Thanks a lot. When you go through the
Mage_Core_Controller_Varien_Action
class you can find the_redirectReferer()
function which has developed similar way as your answer. Thanks and +1 Commented Nov 1, 2013 at 10:05