0
votes

I'm using Laravel 5.4 and vue-js 2.4

Laravel routes

Route::get('/', 'HomeController@home');

HomeController

public function home(Request $request) {
   return view('app');
}

Vue router

const routes = [
    { path: '/', name: 'home', component: App},
    { path: '/about', component: About },
];

When I click on this, about component is well displayed and the url is example.com/about

<router-link to="/about">About</router-link>

Issue

When I enter example.com/about, I'm redirected to the home page of my vue app which is example.com.

What should I do so the about can reach vue-router ?

2
Do you have any other Laravel routes registered? Why aren't you getting a 404 when visiting /about?Joseph Silber
Yes I have a lot but nothing /aboutLéo Coco

2 Answers

0
votes

Route::get('/{component?}', 'HomeController@home');

Seems to be working

0
votes

Add a route to your about page on laravel just like / route:

Route::get('/', 'HomeController@home');
Route::get('/about', 'HomeController@home');