I have Apache 2.4 with Windows and the virtualhost works "half" for me. That is, I have this configuration in the file httpd-vhosts.conf
:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:/Apache24/htdocs/pruebas/api-coches/public"
ServerName api-coches.local
ServerAlias www.api-coches.local
ErrorLog "logs/api-coches.error.log"
CustomLog "logs/api-coches.access.log" common
</VirtualHost>
hosts
And in the file c:\windows\system32\drivers\etc
I have the following record
127.0.0.1 api-coches.local
Then, in the Laravel project, I have these routes defined:
Route::get('/', function()
{
return view('pages.home');
});
Route::get('about', function()
{
return view('pages.about');
});
Route::get('projects', function()
{
return view('pages.projects');
});
Route::get('contact', function()
{
return view('pages.contact');
});
If I run a php artisan route:list
I see the following (among other paths):
Well, if I put in the browser http://api-coches.local
, it uses the route /
and returns me the home.
But if I try to access http://api-coches.local/about
it it gives me a 404 from apache, not even a 404 from laravel.
I have it configured as follows:
In the alias server I think the www is giving you problems. Once I had problems with access to directories so I recommend you put the directory tag.
Cheers!