Zend_Controller_Action_Exception from preDispatch()
-
25-09-2019 - |
Question
How to I redirect to 404 page ("page not found") at preDispatch? Normally within action I can simply write:
throw new Zend_Controller_Action_Exception('Page is not found!', 404);
And it forwards to the appropriate page. How do I make it work for preDispatch?
Solution
this code snippet would help you
$request->setModuleName("module")->setControllerName("error")
->setActionName("error")->setDispatched(true);
or you might use as well
$redirector =
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
consult the documentation for more information
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow