Skip to content

4xx Client errors

404 Not Found

There is nothing at this URL. Search engines drop 404 pages from their index after a while.

Common causes

  • A mistyped or old link, or a changed slug without a redirect.
  • Route not defined, or the domain points to the project root instead of public/.
  • Laravel route model binding found no record.

How to fix a 404 error

  1. 1

    Add a 301 redirect from old URLs to the new ones.

  2. 2

    Point the domain's document root to public/ (or use the .htaccess redirect).

  3. 3

    Run php artisan route:list to see whether the route exists, and php artisan route:clear after deploying.

In Laravel

abort(404), findOrFail() and route model binding send 404. A custom resources/views/errors/404.blade.php gives visitors links instead of a dead end.

Check the status of a URL

The first line of the response shows the status code; -L follows redirects and shows each step.

curl -I https://example.com/page
curl -IL https://example.com/old-page

Frequently asked questions

What does HTTP 404 mean?

There is nothing at this URL. Search engines drop 404 pages from their index after a while.

How do I fix a 404 error?

Add a 301 redirect from old URLs to the new ones. Point the domain's document root to public/ (or use the .htaccess redirect). Run php artisan route:list to see whether the route exists, and php artisan route:clear after deploying.

How does Laravel handle 404?

abort(404), findOrFail() and route model binding send 404. A custom resources/views/errors/404.blade.php gives visitors links instead of a dead end.

Get new articles in your inbox

Practical tutorials and deep dives, about once a week. No spam, unsubscribe anytime.

Privacy policy

Add DEV Talk to your Home Screen

  1. 1 Tap the Share button in Safari's toolbar.
  2. 2 Scroll down and tap Add to Home Screen.
  3. 3 Tap Add. Open it from the Home Screen to read like an app and to turn on notifications with the bell.

We use cookies to improve your experience and analyze traffic. By continuing, you agree to our Privacy Policy.