Zend 301重定向 - 有些神秘地不起作用


Zend 301 Redirects - some mysteriously not working?

>我有一个问题,有些重定向不起作用,有些重定向不起作用。我正在使用一种粗略的重定向方式,即在ErrorControllererrorAction中捕获 url,然后有一些 if 语句,然后按如下方式进行重定向:

 public function errorAction()
    {
        $request = basename($this->getRequest()->getRequestUri());
        $this->getHelper('redirector')->setCode(301);
        if ($request == 'rand.html')
            $this->_redirect('/services/currency/rand');
        if ($request == 'dollar.html')
            $this->_redirect('/services/currency/dollar');
        if ($request == 'zim-dollar-currency.html')
            $this->_redirect('/services/currency/zim');
        //About 20 of these If statements
        $errors = $this->_getParam('error_handler');
        //load appearance stuff
        if (!$errors) {
            $this->view->message = 'You have reached the error page';
            return;
        }
        switch ($errors->type) {
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                // 404 error -- controller or action not found
                $this->getResponse()->setHttpResponseCode(404);
                $priority = Zend_Log::NOTICE;
                $this->view->message = 'Page not found';
                $this->view->headTitle()->prepend('Page Not Found');
                break;
            default:
                // application error
                $this->getResponse()->setHttpResponseCode(500);
                $priority = Zend_Log::CRIT;
                $this->view->message = 'Application error';
                $this->view->headTitle()->prepend('Application error');
                break;
        }
        $this->view->request = $errors->request;
    }
所以,有些

会起作用,有些不会,比如:zim-dollar-currency......

不知道这是为什么。我什至检查过诸如窗口行尾等内容。

尝试将开关构造与默认操作一起使用