I am having a bit of trouble with the routing.
I\'m working on a CMS, and i need two primary routes. /admin and /(:any). The admin
Thanks for the solution William. However methods 1 & 2 aren't working anymore Laravel 4, and in order to use solution #3 in Laravel 4 you will have to fire the 404 event in your start/global.php file.
App::error(function(Exception $exception, $code)
{
// i.o. -> this is our catchall!
// http://stackoverflow.com/questions/13297278/laravel-using-any-wildcard-for-all-routes
Event::fire('404');
return View::make('error')->with('exception', $exception)->with('code', $code);
Log::error($exception);
});
Now we can handle this in our routes.php file:
Event::listen('404', function() {
// url?
$url = Request::path();
// LOGIC HERE
// else
return View::make('error');
});