I\'m using Laravel 4 framework and I\'ve defined a whole bunch of routes, now I wonder for all the undefined urls, how to route them to 404 page?
Undefined routes fires the Symfony\Component\HttpKernel\Exception\NotFoundHttpException
exception which you can handle in the app/start/global.php using the App::error() method like this:
/**
* 404 Errors
*/
App::error(function(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $exception, $code)
{
// handle the exception and show view or redirect to a diff route
return View::make('errors.404');
});