Laravel NotFoundHttpException
NotFoundHttpException thrown by Laravel, this is the solution.
In Laravel we often run to erros or bugs, Laravel cast them to Exceptions, that we catch and show. This can be valuable for you to solve the actual issue. Todays article is about NotFoundHttpException.
This is pretty familiar one to most of us, or sometimes we fall into 404 not found.
NotFoundHttpException
So to explain this, whenever we try to visit a route that either dont exist or that is mistaken we run to this error always. However Laravel catches the error and throw 404 Not Found. This is Laravel exception handling working and providing us with a page not the actual Exception.
The source of this problem, is simply
- we are visiting a route that dont exist if its a
get
route - Or we are trying to
post
to a route that dont exist. Say you have a form that post to a route and dont exist, after you fill in the form, you would be redirected to this error. - Other times we dont find the error on any of those, that would be a redirect method on one of our controllers or logic we wrote. so checking the page we come from is important to find out the redirect sending us to a non existing route.
So whenever this error is thrown, head to page redirecting you to this route, controllers or forms. and make sure you redirect users to the proper route.