php - ZF2 Child routes not working -
after reading numerious articels routing i'm still not able work.
when i'm able go "/portal":
'portal' => array( 'type' => 'literal', 'options' => array( 'route' => '/portal', 'defaults' => array( 'controller' => 'portal\controller\activities', 'action' => 'index', ), ), ),
but when add child_routes so:
'portal' => array( 'type' => 'literal', 'options' => array( 'route' => '/portal', 'defaults' => array( 'controller' => 'portal\controller\activities', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'default' => array( 'type' => 'segment', 'options' => array( 'route' => '[:controller[/:action]]', 'constraints' => array( 'controller' => '[a-za-z][a-za-z0-9_-]*', 'action' => '[a-za-z][a-za-z0-9_-]*' ), 'defaults' => array( '__namespace__' => 'portal\controller', 'action' => 'index' ), ), ), ), ),
i'm still able go "/portal" when go "/portal/activities/index" (which same) "page not found".
hope can help
thanks in advance!
the segment definition not correct, / missing, complete child route /portal[:controller[/:action]]
change :
'portal' => array( 'type' => 'literal', 'options' => array( 'route' => '/portal', 'defaults' => array( 'controller' => 'portal\controller\activities', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'default' => array( 'type' => 'segment', 'options' => array( 'route' => '/[:controller[/:action]]', 'constraints' => array( 'controller' => '[a-za-z][a-za-z0-9_-]*', 'action' => '[a-za-z][a-za-z0-9_-]*' ), 'defaults' => array( '__namespace__' => 'portal\controller', 'action' => 'index' ), ), ), ), ),
Comments
Post a Comment