0
votes

i try using vue router js in laravel, but i get problem when i refresh the page, laravel say "Sorry, the page you are looking for could not be found.", i know this problem from web.php laravel the route not be found and then i try this code in web.php

Route::get('/{name}', function() {
   return redirect('/');
});

so when i try refresh page in url "127.0.0.1:8000/home" it will redirect in "127.0.0.1:8000".

but it's not like I wanted, I wanted was get the same page when refreshing the current page.

please help me, thanks :)

1

1 Answers

0
votes

If you are using the history mode in your router, you must properly configure your server-side app to serve the Vue application on any request that matches route declared in your Vue router.

This could be as simple as a blanket catch-all route to serve the main view.