In my Bootstrap.php I have the following code which defines a route:
$router = Zend_Controller_Front::getInstance()->getRouter();
$router->addRoute('pageDetails', new Zend_Controller_Router_Route('page-details/:uid/:title', array(
'module' => 'default',
'controller' => 'list',
'action' => 'detail',
), array(
'uid' => '\d+',
'title' => '(.*)?',
)));
This works.
Then I tried to change the route setup to using a .ini file where the routes are defined. The .ini file looks like this:
[routes]
pageDetails.route = "page-details/:uid/:title"
pageDetails.default.module = "default"
pageDetails.default.controller = "list"
pageDetails.default.action = "detail"
pageDetails.reqs.uid = "\d+"
pageDetails.reqs.title = "(.*)?"
And I add the routes in Bootstrap.php via:
$config = Zend_Registry::get('config');
$router = Zend_Controller_Front::getInstance()->getRouter();
$router->addConfig(new Zend_Config_Ini($config['routes']['configPathname'], 'routes'));
Although the .ini version and the route defined in PHP code should do exactly the same, the .ini version does not work. There is no error message in the frontend, the links look allright but on clicking a link with this route I just get redirected to the start page.
What is missing?