Zend hostname route doesn't match when it has child routes
Posted
by
talisker
on Stack Overflow
See other posts from Stack Overflow
or by talisker
Published on 2014-04-09T17:07:43Z
Indexed on
2014/06/04
9:25 UTC
Read the original article
Hit count: 243
I am implementing an Admin module, which contains the following routes:
'router' => array(
'routes' => array(
'admin' => array(
'type' => 'Zend\Mvc\Router\Http\Hostname',
'options' => array(
'route' => ':subdomain.mydomain.local',
'constraints' => array(
'subdomain' => 'admin',
),
'defaults' => array(
'module' => '__NAMESPACE__',
'controller' => 'Admin\Controller\Index',
'action' => 'index',
),
),
'priority' => 9000,
'may_terminate' => true,
'child_routes' => array(
'users' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/users',
'defaults' => array(
'module' => '__NAMESPACE__',
'controller' => 'Admin\Controller\Users',
'action' => 'index',
),
),
),
)
),
),
),
And this is the home route configuration:
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'index',
),
),
),
When I try to access to http://admin.mydomain.com
, the route match always with the home
route, but if I remove all the child routes from the admin
route, the behavior is correct and a http://admin.mydomain.com
matches with the admin
route. Any idea?
© Stack Overflow or respective owner