What is the best way to handle routing

what is the more secure route handling:

Making the router do routing automatically

or making the router at Router(false), then I should so some add-> for each controller/action/:parms, so I can handle the not found page, Because my main problem is when a user request :controller/:action/blablabla/blalall/blzzdazd/ No exception/error page will be executed.



14.9k

Can someone help me pls ^^

I've never done it, but from what i've read you could add these rules:

//One route to match controller/action
$router->add("/:controller/:action", array(
   "controller" => "1",
    "action"     => "2",
));

//one or more routes to match actions with parameters:
$router->add("/:controller/:action/{param1:[a-z\-]+}", array(
    "controller" => "1",
    "action"     => "2",
));
$router->add("/:controller/:action/{param1:[a-z0-9\-]+}/{param2:[a-z0-9\-]+}", array(
    "controller" => "1",
    "action"     => "2",
));