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)

$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

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.