0

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 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

3 Comments

I'm still confused :D
All traffic has to go to whatever template you have that has the Vue application running in it.
ok thanks @Marty i will try to configure my server-side app like in documentation :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.