忽略我在Laravel中设置的路线

If I write the following in Laravel:

Route::get('/', function()
{
    echo "here"; exit();
});

and navigate to public/ it's fine!


If I write the following:

Route::get('/a', function()
{
    echo "a here"; exit();
});

And then navigate to public/a

It throws "Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException"

This was working a few days ago so it may be something to do with xampp? But i'm pretty sure mod_rewrite is on?

The htaccess file is untouched

The public directory should be your webroot. Apache does some strange things with .htaccess and the file that Laravel provides, assumes that it is present in the webroot and not a second level directory.

Try configuring xampp so that the vhost has /yourxampppath/laravel/public as the webroot.

Below is an example of the standard vhost that I use. I don't actually use xampp, I have my own development server, but the principal remains the same.

<VirtualHost *:80>
    ServerName hostname.ollieread.com
    ServerAlias hostname.ollieread.com
    DocumentRoot /var/www/hostname.ollieread.com
    ErrorLog logs/hostname.ollieread.com-error_log
    SetEnv APPLICATION_ENV development
</VirtualHost>