You can put this at the end of your routesfile. This worked for me. Found this solution in a repo from Matt Stauffer.
Route::get('/{vue_capture?}', function () {
return view('pages.home');
})->where('vue_capture', '[\/\w\.-]*');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am using Laravel 5.3 with Vue 2 & Vue- Router.
My Problem is if i enable the history mode i cant access the routes directly. So simple: The history mode removes the /#/ from the URL. Therefore if you access for example domain.dev/test is not going to work since Laravel is throwing an NotFoundHttpException Error. Which makes sense of course, because this route doesnt exist in my routes file, since i am using the Vue-Router.
If i come from the Root Site e.g domain.dev and click then on test this is working. But not if i directly enter the full URL e.g domain.dev/test since this is calling a laravel route which doesnt exist.
I hope you understand what i am talking about :)
Is there any way to solve this problem?
I could use the complete Vue Project outside of Laravel, but i want to have it all in my resources/js directory. is there any other Solution?
You can put this at the end of your routesfile. This worked for me. Found this solution in a repo from Matt Stauffer.
Route::get('/{vue_capture?}', function () {
return view('pages.home');
})->where('vue_capture', '[\/\w\.-]*');
Please or to participate in this conversation.