Reputation: 147
I just tried to add a new route in Laravel but it seems it's not working, just getting 404 errors. It only detects the index '/' route. This code is in the routes/web.php
Route::get('/', 'SiteController@mainView')->name('home');
Route::get('secondroute','SiteController@secondRoute')->name('secondRoute');
The Controller is also working, because it doesnt matter if the index Route (/) is the mainView or SecondRoute so it has to be something with the routing itself?
Thanks
Edit: Mod Rewrite is on
Edit2: I'm using a Ubuntu on a Virtual Machine with Apache 2.4.25
Edit3:
public function secondRoute(){
return view('myself', ['title' => 'Myself']);
}
Upvotes: 0
Views: 582
Reputation: 153
You missed '/' in second route
change
Route::get('secondroute','SiteController@secondRoute')->name('secondRoute');
to
Route::get('/secondroute','SiteController@secondRoute')->name('secondRoute');
Upvotes: 1