A NotFoundHttpException
exception in Laravel always means that it was not able to find a router for a particular URL. And in your case this is probably a problem in your web server configuration, virtual host (site) configuratio, or .htaccess configuration.
Your public/.htaccess should look like this:
<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>
As you can see there is a condition in the first line IfModule mod_rewrite.c
, so if you don`t have mode_rewrite installed or enabled, all rewrite rules will fail and this
localhost/Test/public/
Will work fine, but not this:
localhost/Test/public/test
In other hand, this one should work too, because this is its raw form:
localhost/Test/public/index.php/test
Because Laravel needs it to be rewritten to work.
And note that you should not be using /public, your URLs should look like this:
localhost/Test/
This is another clue that your virtual host's document root is not properly configured or not pointing to /var/www/Test/public, or whatever path your application is in.
All this assuming you are using Apache 2.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…