Redirecting with Zend Framework – part 2

Recently I posted about the redirecting mechanism of Zend Framework. It’s a working chunk of code but the problem is that it seems quite difficult in according with other ZF sample codes.

Yes the same goal can be achieved with less effort. Like the _forward function which just executes other action/controller, you can call the _redirect method to rewrite the URI.

Just use that in any action of any controller:

$this->_redirect('http://www.example.com');

That executes exactly the same as calling the header PHP method or echoing the <meta> refresher!

2 thoughts on “Redirecting with Zend Framework – part 2

Leave a Reply

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