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

Root Route is always points to IndexController

As I see in Phosphorum source, routes.php, it points '/' route to Discussions::index

$router->add('/', array(
    'controller' => 'discussions',
    'action' => 'index'
));

So I did the same in my App, but somehow it always route https://localhost/ to IndexController. How can it be?

Another question, as I understood I can't delete IndexController, even I don't need it, right?

Nope, it was enabled. Thanks for notify me, I'm just don't know about this argument, and missed it when looking at code. But when default routes was disabled - nothing changed.

edited Oct '14

I tried to set defaults:

//Using an array
$router->setDefaults(array(
            "controller" => "board",
            "action" => "index"
));

This way it works, but another routes which is not in list of routes for example https://localhost/qwerty is also go to homepage instead of throwing 404.



98.9k

Can you post please the part of the app that is not working on a gist? or github?

edited Oct '14

Here is desired route:

$router->add("/", array(
            'controller' => 'board',
            'action' => 'index'
));

But when I go https://localhost or https://localhost/ it gets an infinite loop of redirections...



98.9k

Are you still having problems with this?