Symfony\Component\HttpKernel\Exception\
NotFoundHttpException Laravel
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.
Laravel error 8 Symfony\Component\HttpKernel\Exception\
NotFoundHttpException
As per the documentation, the routes defined in the routes/api.php
file are reachable by prepending api
before the URL
, therefore, the axios.defaults.baseURL
should be http://localhost:8000/api
.
Laravel 5 Symfony\Component\HttpKernel\Exception\
NotFoundHttpException: POST http://localhost/myproject/public/leads
I solved it. I change to config\app.php
file
'url' =>'http://localhost/myscript_addres/public',
To
'url' =>'http://localhost/',
Laravel error Symfony \ Component \ HttpKernel \ Exception \
NotFoundHttpException
Actually you should use (Remove $
from {$slug}
):
Route::get('/posts/{slug}', array(
'as' => 'post-show',
'uses' => 'PostController@getShow'
));
Also change:
<a href="{{ URL::action('post-show', $post->slug) }}">Read more →</a>
To this:
<a href="{{ URL::route('post-show', $post->slug) }}">Read more →</a>
Or use route
helper function:
<a href="{{ route('post-show', $post->slug) }}">Read more →</a>
Symfony\Component\HttpKernel\Exception\
NotFoundHttpException
Change your environment file to fix this problem
Previously
APP_URL=localhost
Changed it to
APP_URL=http://localhost
Related Topics
Codeigniter Assets Folder Best Practice
How to Install the Intl Extension for Twig
PHP Session Ids -- How Are They Generated
How to Declare a Method Static and Nonstatic in PHP
Href="" Automatically Adds to Current Page Url (In PHP). Can't Figure It Out
In PHP, How to Get the First and Last Date of a Month
Turn Plain Text Urls into Active Links Using PHP
Upload Multiple Image File Using Httpurlconnection
PHP Strtotime +1 Month Adding an Extra Month
How to Use PHP in a JavaScript Function
How to Detect If Have to Apply Utf-8 Decode or Encode on a String
Error_Reporting(E_All) Does Not Produce an Error
What Does the Dot-Slash Do to PHP Include Calls