Laravel Virtual Host Request Url Not Found
I have a problem with my laravel application using VirtualHosts, I can see the laravel home page, but when I try to make a route like advkit.dev/login, I get: "The requested URL / login was not found on this server." So all my routes are not working, does anyone know what I need to change in my code to get the routes to work. I also set debug to true and I get the debug console on the home page like advkit.dev no else else
Route:
<?php
Route::get('/', function()
{
return View::make('hello');
});
// login.blade.php
Route::get('/login', function() {
return View::make('login');
});
the hosts
127.0.0.1 www.localhost.com
127.0.0.2 advkit.dev
Httpd-hosts file
<VirtualHost advkit.dev>
DocumentRoot C:\wamp\www\advkit\public
ServerName advkit.dev
</VirtualHost>
source to share
I had the same problem and the virtualhost setup given in the following answer worked for me: fooobar.com/questions/2238636 / ...
<Directory "C:/myproject/mysubfolder/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
source to share
It looks like Apache is ignoring your file .htaccess
. You can fix this, but the best solution is to put the contents of this file .htaccess
on your virtual host. Then your virtual host will look like this:
<VirtualHost advkit.dev>
DocumentRoot C:\wamp\www\advkit\public
ServerName advkit.dev
<Directory C:\wamp\www\advkit\public>
# Ignore the .htaccess file in this directory
AllowOverride None
# Rewrite URLs
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
</VirtualHost>
source to share