HTTP status code lookup

404 Not Found: What It Means and How to Fix It

A 404 Not Found response means the server is reachable but has nothing at the requested URL. The page, file or API resource doesn't exist, or the server won't say that it does.

One 404 from a mistyped link or an old bookmark is harmless. It matters when links on your own site, files your pages load, or pages that used to get search traffic start returning it.

404

Not Found

The server can't find the requested resource. The URL may be wrong or the page may have been removed.

Look up any other status code →

Common causes

  • A typo in the URL, or the wrong case: on most Linux servers /About and /about are different paths.
  • The page was moved or deleted without a redirect from the old URL.
  • A single-page app only works from the homepage: client-side routes such as /dashboard return 404 on refresh or a direct visit because the server has no file at that path.
  • A missing or extra trailing slash, or a wrong base path after deploying the app to a subfolder.
  • A file referenced by its build hash, such as main.3f9a.js, no longer exists after a new deploy, while a cached page still asks for it.
  • For APIs: a wrong base URL or version prefix such as /api/v1, or an ID that doesn't exist.

Debugging steps

  • Copy the exact URL from your browser's network tab and check its case, slashes and encoded characters.
  • Find out who answered. Response headers such as server, cf-ray or x-vercel-id show whether the 404 came from a CDN, a proxy or your application.
  • Check that the route or file exists in what was actually deployed, not just in your local project.
  • For an API, call the same URL with curl and compare it with the routes the framework lists.

Fix 404s on refresh in single-page apps

Tell the server to answer unknown paths with the app's index.html, so the client-side router can handle them:

# nginx
location / {
  try_files $uri $uri/ /index.html;
}

# Apache (.htaccess)
FallbackResource /index.html

404s and SEO

  • 404s for URLs that never existed don't hurt the rest of your site. Search engines expect them.
  • When a page has moved, redirect the old URL to the new one with a 301 so visitors and ranking signals follow.
  • When a page is gone for good, a 404 or a 410 Gone is correct. Don't redirect everything to the homepage instead.
  • A custom "page not found" page must still return the status 404. If it returns 200, Google reports it as a soft 404.

Frequently asked questions

What is the difference between 404 and 410?

404 says nothing is at that URL, without saying whether it's permanent. 410 Gone says it was removed on purpose and won't come back. Search engines drop both from their index; a 410 can be dropped slightly sooner.

What is a soft 404?

A page that tells visitors it doesn't exist, or has almost no content, but returns 200 OK. Search engines treat it as missing anyway and report it as an error. Return a real 404 status, or give the page useful content.

Should an API return 404 or an empty list?

Return 200 with an empty list when a search or collection has no results. Return 404 when a specific resource, such as /users/42, doesn't exist.

More http status code lookup guides

Open the full http status code lookup →

From the blog