Laravel 5.1 Route object not found

Please help me, I am working on Laravel using the latest version of xampp and do not know what is the cause of my problem.

This route works fine:

Route::get('/', function () {
    return 'aa';
});

      

This route gives the error "Object not found!":

Route::get('about', function () {
    return 'aaa';
});

      

httpd.vhosts:

<VirtualHost test.loc:80>
   DocumentRoot "C:/xampp/apps/test.loc/public"
   ServerName test.loc
   <Directory "C:/xampp/apps/test.loc/public">
            #AllowOverride All - when I use this, I get a "Access forbidden!" for all routes
        Require all granted - this works for the main route, other routes give "errors".
</Directory>

      

/public/.htaccess:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

      

+2


source to share


3 answers


I faced the same problem, but finally it worked for me.



.....
<Directory "C:/xampp/apps/test.loc/public">
   Options Indexes FollowSymLinks Includes ExecCGI
   AllowOverride All
   Require all granted
</Directory>

      

+5


source


Add this to your httpd.vhosts file



<VirtualHost test.loc:80> 

 ServerName test.loc
 DocumentRoot "C:/xampp/apps/test.loc/public"
  <Directory "C:/xampp/apps/test.loc/public">
     Options Indexes FollowSymLinks MultiViews
     AllowOverride All
     Order allow,deny
     allow from all
 </Directory>

      

+1


source


Have you tried adding a forward slash before the name? eg:

Route::get('/about', function () {
    return 'aaa';
});

      

-1


source







All Articles