jeudi 1 septembre 2016

Laravel return the page on any address except from routes

I have a list of routes for my Laravel application. Now, I want to return the same page as is returned on / for all routes that are not listed. I.e.

/hello/world <-> binded to "Hello world" page
/blah/blah <-> binded to "Blah Blah" p

Now, no matter what user requests (GET) and how many slashes in the request are (/asdfda/sadfasdf/asdfasdf, eafsadfsda, asdfadsfasd/adsfsdaf), I want to return the same page. I do not want it to be 404 though, as I want to keep that a legal route.


I tried

Route::get('{all?}', [
    'as' => 'spa.index',
    'uses' => 'SPAController@index',
]);

But that works only if there are no slashes.


Do someone knows how to do that?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2bGumo8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire