Reputation: 829
I am using Laravel and vue.js to make a SPA. So my routes looks like this:
In my routes/web.php
Route::get('/{any}' , 'SinglePageController@index')->where('any', '.*');
and then, the entire route will be handled by the vue router
.
However, I decided to make a Multiple Pages(for my SEO) on other Pages while the SPA is for the loggedin users only.
I'm going to add another route in web.php
but it returns 404 .
Route::get('/guests', 'GuestController@index');
[Note that I have GuestController
and blades]
Is it possible? If so, please give me hints. I tried to search on google but haven't found.
Upvotes: 0
Views: 82
Reputation: 10076
Yes, you just have to place your route for /guests
before your more general /{any}
. Remember, Laravel check routes from top to bottom and the first matched will be used.
Route::get('/guests', 'GuestController@index');
// other specific routes
// ...
Route::get('/{any}' , 'SinglePageController@index')->where('any', '.*');
Upvotes: 2