You can create a route type literal, with a child route type segment :
'router' => array(
'routes' => array(
'user' => array(
'type' => 'Literal',
'options' => array(
'route' => '/user',
'defaults' => array(
'__NAMESPACE__' => 'MyModule\Controller',
'controller' => 'User',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action[/:id]]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
),
),
),
),
),
),
),
or if you prefer, directly declare the controller name as a route parameter in a route type segment :
'router' => array(
'routes' => array(
'user' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action[/:id]]]',
'defaults' => array(
'__NAMESPACE__' => 'MyModule\Controller',
'controller' => 'User',
'action' => 'index',
),
),
),
),
),
I prefer the first way to avoid route's conflicts between modules controllers
what you can also do if you have multiples controllers for a specific section of your app (here : user), and multiples sections of your app controlled in the same module => organise your controllers in different namespaces like :
namespace MyModule\Controller\Users;