I am not sure that I understand your question.
Are you saying that you have more than one module that are mapping their router to the same url?
If these are your own modules, then @ALTAMASH80’s suggestion is correct, you can set the url in the 'route' => '/yoururl'
config for the router of each module. Typically, a module config file is located in modulename/config/module.config.php
if you started your project from the Laminas MVC Skeleton.
It gets trickier when you want to overwrite the routes from 3rd-party modules that you include via composer. For example, if you include lm-commons/lmcuser as a module for user management, that module provides routes that map to /user, /user/login, etc.
LmcUser’s router config is:
'router' => [
'routes' => [
'lmcuser' => [
'type' => Literal::class,
'priority' => 1000,
'options' => [
'route' => '/user',
'defaults' => [
'controller' => 'lmcuser',
'action' => 'index',
],
],
...
This dispatches /user
to the LmcUser Controller Index action.
If you wanted to use /user
for other purpose, then you need to overwrite LmcUser’s router config with someting like:
'router' => [
'routes' => [
'lmcuser' => [
'type' => Literal::class,
'options' => [
'route' => '/user',
'defaults' => [
'controller' => YourController::class,
'action' => 'youraction',
],
],
Because all the module config files and the config files in the /config/autoload
folders are merged at bootstrap, you need to make sure that your module, which needs the overwrite, is processed after LmcUser. This can be done by listing your module after LmcUser in the modules.config.php
. (This is only true if you use the Skeleton as the starting point since it is possible to set up bootstraping differently). This is not bullet proof because it ultimately depends on the order in which the config files are merged.
I hope this answers your question and is not bringing more confusion.
Regards
Eric