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

Default route ('/') on a localhost

-

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

$router->removeExtraSlashes(true);

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

$router->notFound(array(
    'controller' => 'index',
    'action' => 'page404'
));

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

return $router;

When accessing application without any route (https://localhost/myapp/) it shows notFound page (other routes work fine). If I use virtual host - everything works as expected. Any thoughts about that?

Strange behavior. I tested the routes on my localhost and everything works well. Do you use any .htaccess files?



19.2k

Yep, created project with devtools. Must be something wrong with apache cfg...



3.0k

Bump!

Anyone on this!? chebureque, did you manage to sort this out?



19.2k
edited Jun '14

@Eduardo, actually not. I've reinstalled web-server and problem persists.

UPD: workaround for this - remove notFound route from router and handle it in dispatcher (docs)