How to redirect to non-zend link from zend application

Awan picture Awan · Nov 12, 2010 · Viewed 7.5k times · Source

My application is mixture of simple PHP webpages and zend application. Sometime I need to redirect to simple PHP webpage from zend application's Action.

For example:

I want to redirect from example.com/module/controller/action to example.com/simplephp.php.

I tried header("Location: example.com/simplephp.php"); but it is not working.

Thanks

Answer

mjh_ca picture mjh_ca · Nov 12, 2010

Yes, the basic redirect action helper allows you to redirect to any URL.

class MyController extends Zend_Controller_Action {
    public function indexAction() {

        $this->_redirect('/path/to/any/page.php');
        // or
        $this->_redirect('http://example.com/anypage.php');
    }
}