开发者

stopping page not found errors when controller does not exist

In production mode (minimal errors), when a controller is not found, Zend gives a 404 page not found error. There are a couple of controllers that I don't want this activated for. Even though they don't exist, I don't want the开发者_如何学Go page not found error activated. Is it possible to somehow block that error and give an empty page. I'm guessing, if at all possible, it has to be done at the plugin level since no controller really exists to handle this.


One possible solution would be to check the request object in your errorAction for controller and/or action that threw the exceptions (for non-existing controllers and actions you could also get their names this way). Based on this you could customize the rest of errorAction. For example:

 public function errorAction() {
        $errors = $this->_getParam('error_handler');

        $whatController = $errors->request->getControllerName();

        if ('secretController' == $whatController) {
             return $this->_redirect('blankErrorPage');
        }

        // usual rest of errorAction
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜