News and Event Detail

404 Not Found, but route exist in Laravel 5.4

404 Not Found, but route exist in Laravel 5.4

Date: 2022-12-12 #Js #laravel #css

I'm not entirely sure why all the down-votes, especially since this is a common issue and the cause can be hidden for someone new to the Laravel environment. I know this is an old post, but I add it here for future newbies.

The first thing I suggest trying is running php artisan route:list from the command line (from your project root directory). This will list all the routes that Laravel can register and if there are any errors, usually they will show up here.

The second thing I suggest is to ensure that the URL matches route. I can't tell you how many times I've tried to figure out why my route was returning a 404 simply because my form was posting to something like /insertStudent when my route was defined as /admin/insertStudent

The third thing I suggest is to ensure the method you are calling exists. Are your methods really called postSignIn and postInsertStudent and not simply SignIn and InsertStudent? Keep in mind that both the URL and method names are case sensitive and should match where you define the route, the URL that is being called, and the method that is receiving the request.

Finally if all that checks out, one last thing I might suggest you try is running php artisan route:clear. This resets the route cache.