Setting a Zend Framework _redirect Referer

Seems to be impossible, just because the only parameters you can set are far less than setting a referrer. Thus you’ve to rely on your browser capabilities. However the most reliable way is to redirect with referrer in mind. Something like _GET parameters.

$this->_redirect('/url/return-to/1');

Once this parameter is processed by the controller/action you can return to the referrer!

2 thoughts on “Setting a Zend Framework _redirect Referer

  1. other ways to do

    //example 1
    $this->_helper->getHelper(‘Redirector’)->gotoSimple(‘action’, ‘controller’, ‘module’, array(‘param1’ => $value1, ‘param2’=>$value2));

    //example 2
    return $this->_forward(‘action’,’controller’,’module’, array(‘param1’=>$param1));

  2. i forgot,
    //example 3

    in your view send:
    $backurl = urlencode($this->Url());

    in your action:
    $this->_helper->getHelper(‘Redirector’)->gotoUrl(urldecode($backurl))

Leave a Reply

Your email address will not be published. Required fields are marked *