When i use only langRoute and moduleRoute i have not any problems. But when i add pageRoute it is not work properly. I have tried many another ways do it (Regex etc) but none gives the desired result. Can anybody help me?
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
//Route_page needs dispatcher and request
$dispatcher = $front->getDispatcher();
$request = $front->getRequest();
// Add languag routes
$langRoute = new Zend_Controller_Router_Route_Hostname(
':language.domain.com',
array(
'language' => 'ru',
),
array(
'language' => '^(ru|en)$',
)
);
// Add module routes
$moduleRoute = new Zend_Controller_Router_Route_Module(array(),$dispatcher,$request);
// Add page routes
$pageRoute = new Zend_Controller_Router_Route(
':uri\.html',
array(
'controller' => 'index',
'module' => 'default',
'action' => 'index',
'uri' => 'index',
),
array ('uri' => '[0-9a-z\-]+')
);
// Add chain routes
$chainedRoute = new Zend_Controller_Router_Route_Chain();
$chainedRoute->chain($pageRoute);
$chainedRoute->chain($langRoute)->chain($moduleRoute);
$router->addRoute('default', $chainedRoute);