dont u have to use the name of the route instead of the path?
<router-link to="subCate">url to example</router-link>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am Building a Vue SPA with Laravel. I have a several route here. if I brows my home route i.e. example.com it working fine. But if I brows other routes i.e example.com/subCate it gives me following error: Not Found The requested URL /subCate was not found on this server.
Following are my codes:
<?php
Route::get('/{any}', 'SpaController@index')->where('any', '.*');
<?php
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
import App from './views/App'
import Hello from './views/Hello'
import Home from './views/productList'
import Product from './views/productList'
import ProductDetails from './views/ProductDetails'
import SubCate from './views/subcate'
const router = new VueRouter({
mode: 'history',
routes: [
{
path: '/',
name: 'home',
component: Home
},
{
path: '/hello',
name: 'hello',
component: Hello,
},
{
path: '/product',
name: 'product',
component: Product,
},
{
path: '/productDetails',
name: 'productDetails',
component: ProductDetails,
},
{
path: '/subCate',
name: 'subCate',
component: SubCate,
},
],
});
const app = new Vue({
el: '#app',
components: { App },
router,
});
<router-link to="/subCate"><a>url to example</a></router-link>
Please or to participate in this conversation.