Laravel无法访问其他路由,但根目录(使用XAMPP)

I have just started using Laravel (v5.7) and I am trying to set it up to work in a virtual host (I'm using the XAMPP package for Windows).

To simplify, the only Route that works is the get('/', ...). Other routes, like get('/other', ...) fails with Error 404. The other routes are only accessable when running the php artisan serve server, so I can use port 8000.

However, I wish Apache was handling the requests, without the need of idenifying the port. Is that simple?

A very straight forward code that I'm using and isn't working follows (without controllers):

// ROUTE in routes/web.php
Route::get('/', function() {
    return view('home');
});
Route::get('/other', function() {
    return view('other');
});

NOTE: I do have both view files home.blade.php and other.blade.php in resources/views directory.

XAMPP can't make very clean URLs.
You have to point your routes to the public folder, not the application root.
So instead of localhost/MyProject/other
Try localhost/MyProject/public/other

When you change route file you should run this artisan command php artisan route:cache that clear route cache.

Can you try my it.

Had the same error you can try using php artisan serve it solved the issue

Or you can try setting up the host in the following files C:\xampp\apache\conf\extra\httpd-vhosts.conf and

C:\Windows\System32\drivers\etc\hosts