Search code examples
laravelwebsubdomain

Laravel on subdomain, web.php not routing


I tested my web.php and it is working. I even tried it with simple code:

Route::get('foo', function () { return 'Hello World'; });

and i get a 404 error.

Also: On the subdomain.example.com i get my custom programmed laravel 404 error but on subdomain.example.com/foo i get a 404 apache error.

The apache error:

Not Found

The requested URL was not found on this server.
Apache/2.4.18 (Ubuntu) Server at subdomain.example.com Port 80

Why are my routes not working?

Why is there a laravel error on "/" and a (i assume) apache error on "/foo"?


Solution

  • This is not a Laravel issue, you need to set the Apache configuration file for setting the document root to your Laravel project's public folder.