Redirect functions in magento

Following redirect functions are present in app/code/core/Mage/Core/Controller/Varien/Action.php file.

  1. Redirect specific url : _redirectUrl($url);
  2. Redirect to specific path :  _redirect($path, $arguments=array());
  3. Success page redirection : _redirectSuccess($defaultUrl);
  4. Error page redirection : _redirectError($defaultUrl);
  5. Set referer url to redirect : _redirectReferer($defaultUrl=null);
  6. Get referer url via HTTP_REFERER, regular or requested param : _getRefererUrl()


In your controller class, you can use as follows

 $this->_redirect($path, $arguments=array());
 // or use,

Here is another way,

//For simple url redirect:

 $url = "";

// Redirect with arguments
 Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl($path, $arguments));