I have the following code in my bootstrap. It works well, however, with any module besides default it redirects to the default module. How can I get this to to work with modules besides the default module?
protected function _initRoutes()
{
$this->bootstrap(array('FrontController'));
$router = $this->getResource('Frontcontroller')->getRouter();
$router->removeDefaultRoutes();
$language = new Zend_Controller_Router_Route(
':language', array('language' =>'en')
);
$module = new Zend_Controller_Router_Route_Module(
array(
'module' => 'default',
'controller'=> 'index',
'action' => 'index'
),
Zend_Controller_Front::getInstance()->getDispatcher(),
Zend_Controller_Front::getInstance()->getRequest()
);
$module->isAbstract(true);
$default = new Zend_Controller_Router_Route_Chain();
$default->chain($language);
$default->chain($module);
$router->addRoute('default', $default);
}
Here is and example how to chain language route with default route working with different modules.
You should not specify the module to 'default' in your $module route
$module = new Zend_Controller_Router_Route_Module(
array(),
Zend_Controller_Front::getInstance()->getDispatcher(),
Zend_Controller_Front::getInstance()->getRequest()
);