Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Help with setting / route

In a multi module application I'm trying to set the / route using:

  $router->add('/', array(
  'module' => 'frontend',
  'namespace' => 'Ammo\Frontend\Modules\Application\Controllers',
  'controller' => 'index',
  'action' => 'someaction'
  ));
$router->notFound(array(
        'module' => 'frontend',
        'namespace' => 'Ammo\Frontend\Modules\Application\Controllers',
        "controller" => "error",
        "action" => "route404"
));

the router seems to ignore this entry for the web site home (no route). I've tried with:

$router = new Router(FALSE); and $router = new Router();

web site root in always fires NotFound route.

Any help??



36.5k
Accepted
answer

Thank you for this. Although using groups did not solve my problem. I'm finding if I set a default module/controller/action and remove the notFound route my main web page is fond (although it is obviously not matching the route->add('/') but using the default route). Also, all notFound routes match to the default module/controller/action defined.

If I add the notFound route, this works great for no routes matched, but also matches to no route http://www.website.com

:(

please disregard. var dump of request is showing array(1) { ["_url"]=> string(11) "/index.html" }

it's an apache issue.



20.7k

How did you solve it?