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

(not solved) Multiple module routing with "special" directory structure

I have the following directory structure:

/app
    /config
    /controllers
    /models
    /views
/backend
    /app
        /controllers
        /views
    /public
/public

The frontend module's controllers are located at /app/controllers and the views at /app/views. Similar to the backend module, just the app directory is located at /backend/app.

Currently the frontend routing works but there seems problems identifying the backend module when I open example.com/backend. The controller "Controllers\Frontend\BackendController" could not be found.

I would say I have to edit the .htaccess files?

I'm glad if anyone could help me solving this problem.

P.S: Project is available on GitHub (https://github.com/tyurderi/teeworlds-dev)



85.5k
Accepted
answer
edited Oct '15

can you change this https://github.com/tyurderi/teeworlds-dev/blob/master/app/config/router.php#L3 to

$router = new Phalcon\Mvc\Router(false);


7.0k
edited Oct '15

Works. Thank you!

edit: Damn it. Works, but it routes now to frontend instead of backend.



85.5k
edited Oct '15

at what url exacly opens frontend module ?

//edit

add

$router->removeExtraSlashes(true);

just to be sure



7.0k

This seems really to work. Thank you again, Izo. :)



85.5k