We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How change the base uri depending on the current Module

I'm making a multu module application (frontend and backend module):

let's say that my app directory is in:

https://localhost/MyApp/,

The frontend module is based on the base uri of the application ( https://localhost/MyApp/:controller/:actions...)

The backend module is executed when https://localhost/MyApp/backend/:controller/:action

But the problem that I have to define all the routes for the second module like this

$router->add('/backend/products(\/|)', array(
    'module' => 'backend',
    'controller' => 'products',
    'action' => 'index',
));

even if I define the backend is the default module, I have to tell the router every uri to mach.

Not sure if i got it right.. You try to get a global route for your backend module which will handle all controllers?

If yes, what about:

$router->add("/backend/:controller", array(
    'module'     => 'backend',
    'controller' => 1,
));