Laravel Vue Router returns 404 page Laravel Vue Router returns 404 page laravel laravel

Laravel Vue Router returns 404 page


Just found the solution:

Route::get('/{vue_capture?}', function () {    return view('layouts.master');})->where('vue_capture', '[\/\w\.-]*');

This helps the Laravel to capture URLs generated by Vue! That's it!


First put this in your web.php

Route::get('/{any}', [\App\Http\Controllers\TestController::class,'home'])->where('any', '.*');

then in your router.js use thisconst routes = [

    {        path: '/',        component: () => import('./pages/Layout'),        children: [            { path: '', component: () => import('./components/DataTable') },        ]    },    ];