The rest-route is overriding the module given in the hostname route. You
may try this (not tested):
$restRoute = new Zend_Rest_Route($front, array('module' => 'api'),
array('api'));
This should enforce the api-module if the first segment of the URL does
not match any existing module.
Kyle Spraggs wrote on 14.11.2009 09:15:
Is it possible to chain a Router_Route_Hostname to a Zend_Rest_Route? I'm
attempting to redirect http://api.mydomain.com to the "api" module using a
RESTful approach and I'm having no such luck. They work independently fine
but when I try to combine them everything blows up. Here's the code from my
bootstrap.
public function _initRoute()
{
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$apiRoute = new
Zend_Controller_Router_Route_Hostname('api.test.dev',
array('module' => 'api'));
$restRoute = new Zend_Rest_Route($front, array(), array('api'));
$router->addRoute('api', $apiRoute->chain($restRoute));
}
And the corresponding request paramaters for http://api.test.dev/events.json
array (
'format' => 'json',
'controller' => 'events',
'action' => 'index',
'module' => 'default',
)
Any help would be greatly appreciated.
Thanks,
Kyle Spraggs (the...@spiffyjr.me)
http://www.spiffyjr.me