Level 1
just set up a capture route that grabs all valid URLs and passes them the view that's outputting your Vue code.
Route::get('/{vue_capture?}', function () {
return view('home');
})->where('vue_capture', '[\/\w\.-]*');
10 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi. I have used vue-router for my static pages but I have a login page which route is defined in laravel routes. I try to access login page then click "Back" button in the browser, vue-router links doesn't recognized anymore. What should I do?
It says
NotFoundHttpException in RouteCollection.php line 161:
Here's my router.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from './components/Home.vue'
import About from './components/About.vue'
import OurMission from './components/Mission.vue'
import OurVision from './components/Vision.vue'
import Services from './components/Services.vue'
import ContactUs from './components/Contact.vue'
import Sidebar from './components/Sidebar.vue'
let routes=[
{
path:'/',
component: Home
},
{
path:'/about-us',
component: About
},
{
path:'/our-mission',
component: OurMission
},
{
path:'/our-vision',
component: OurVision
},
{
path:'/services',
component: Services
},
{
path:'/contact-us',
component: ContactUs
}
];
export default new VueRouter({
hashbang: false,
history: true,
mode: 'history',
routes
})
Please or to participate in this conversation.