1
votes

I have a custom route controller that checks the database before returning view. that being said I'm not passing any parameters to this controller besides the first and never will. Is there a way to stop laravel from expecting a parameter? I'm getting this error:

mydomain/login ---- Works Fine

mydomain/login/sometext -- Throws error

"Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException" /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php

routes.php

Route::get('/', function(){return View::make('main.landing');});
Route::get('/{path}', array('uses' => 'RouteController@index'));

Then in my RouteController I take $path and query database to check if route exists and then displays the custom view.

Any help would be greatly appreciated! Thanks!

2
Please post your routes definitions. - Bogdan
Just did. Thanks Bogdan. - btaylor507

2 Answers

3
votes

You need to specify to the router that you want to allow slashes in your route parameter. You can do it like so:

Route::get('/{path}', array('uses' => 'RouteController@index'))->where('path', '(.*)');

This will allow any character.

1
votes

By default route parameters do not accept slashes. You need to explicitly allow any characters in your path parameter:

Route::get('/{path}', array('uses' => 'RouteController@index'))
    ->where('path', '(.*)');