I want to add a conditional to my bootstrap that, if some check is true, sends all traffic, regardless of the request, to a specific controller/action.

Right now, I'm overriding all the previously defined routers with a wildcard that catches everything:

public function _initSite()
{
    <existing initialization>

    if (<some condition>) {
        $override = new Zend_Controller_Router_Route(
            '*', array('controller' => 'my_con', 'action' => 'my_act')
        );
        $this->getResource('FrontController')
             ->getRouter()
             ->addRoute('override', $override);
    }

}

This seems a rather roundabout way of doing it. Am I missing something more obvious?

Thanks,

Reply via email to