Redirection in Zend Framework

Quite often you need to redirect to another controller/action after a decision in the controller. Sometimes you need to redirect to a whole different site. This is how I do redirects in Zend Framework 1.10:

Redirect to another controller and/or action
For this I use the Zend_Controller_Action_Helper function redirector(action, controller name)

1$this->_helper->redirector('display', 'index');

This will redirect to the displayAction in the indexController

Redirect to another site
For this I use the Zend_Controller_Action function redirect(url). The redirect function takes an full url as input (you can also supply an array with redirect options)

This will redirect you to the Zend Framework site

Comments are closed.