It is common to need to redirect from one controller action to another or even from one controller to another when coding with the Zend Framework. From my code reviews, I find that many people are using the _redirect() method from Zend_Controller_Action. This function takes a url and an optional array of options. This is a fine choice if you need to redirect to a completely different website but the vast majority of redirect in a web application is to another action within the same application.

The lesser known, and much easier, way to redirect within the Zend Framework is to use the Redirector Zend Controller Action Helper

The syntax is much easier since you don’t have to reconstruct a complete url, you just pass in the action and controller names. In fact, the only required parameter is the name of the action. If only an action name is given then the current controller is assumed to be the target controller. Here is a quick example.

_helper->redirector('target', 'example');
    // NOTE: 'example' is optional since the default target controller
    // is the current controller

  public function targetAction() {
    // Do some things...