404 Not Found
The HTTP 404 Not Found status code is a common client error returned by the server to indicate a resource cannot be found at the specified address.
The response is cacheable by default. To override this behavior, the response must include appropriate HTTP caching headers.
Usage
When a 404 Not Found error arrives, the status does not specify whether the resource is permanently unavailable, temporarily unavailable, or never existed. This error most often results from mistyped URLs and is frequently seen by developers working with a set of resources still in progress.
Links to addresses returning 404 Not Found are commonly known as dead links or broken links. The status has also been used when a server is unwilling to acknowledge a resource exists.
When the server knows the resource once existed at the specified address but has been permanently removed, a 410 Gone status is more informative.
Because this error is so commonly seen by end-users, many servers use a custom error page descriptive and relevant for their site.
SEO impact
Search engines like Google do not index a URL returning a 404 status. Previously indexed URLs returning this status code are removed from search results. Pages returning this code do not waste crawl budget. Google treats 404 and 410 identically. Both remove content from the index at the same rate. Bingbot treats 404 as a content removal signal and de-indexes the URL after confirming the status on a subsequent re-crawl. Returning 200 with error content instead of a proper 404 creates a soft 404, which wastes crawl budget and erodes trust in the site's server signals.
Example
The client requests a resource and the server responds with 404 Not Found because the resource does not exist at the specified address.
Request
GET /documents/secret-formula.pdf HTTP/1.1
Host: www.example.re
Response
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: 216
<html>
<head>
<title>Resource Not Found</title>
</head>
<body>
<p>The requested resource was not found.
Check the spelling of the address.</p>
</body>
</html>
How to fix
A 404 Not Found means no resource exists at the requested address.
Verify the URL spelling and path. Typos in the path, filename, or query string are the most common cause. Double-check every segment of the address. Copy the path directly from the source link rather than typing manually.
Check for case sensitivity. Linux-based servers treat
/Pageand/pageas different paths. Match the exact casing of the original URL. Windows-based IIS servers are case-insensitive by default, so a 404 on IIS points to a genuinely missing resource.Look for a missing trailing slash. Some servers distinguish between
/pathand/path/. Add or remove the trailing slash and retry. nginx and Apache handle trailing slashes differently depending ontry_filesandDirectorySlashconfiguration.Confirm the resource exists on the server. Verify the file or route is deployed and accessible. SSH into the server and confirm the file exists at the expected document root path. In nginx, check the
rootoraliasdirective in the matchinglocationblock. In Apache, checkDocumentRootin the virtual host.Set up 301 or 308 Redirects for moved content. When a resource moves to a new address, redirect the old URL to prevent broken links. In nginx:
location = /old-path { return 301 /new-path; }In Apache
.htaccess:Redirect 301 /old-path /new-pathCheck server rewrite rules. Review
mod_rewriterules in Apache ortry_filesandlocationblocks in nginx. A misconfigured rewrite silently drops requests to valid paths. Enable rewrite logging to trace the rule evaluation. In Apache, setLogLevel alert rewrite:trace3temporarily.Verify MIME types and handler mappings on IIS. IIS returns 404.3 when a file extension lacks a registered MIME type or handler mapping. Add the missing MIME type in IIS Manager or through
web.config:<staticContent> <mimeMap fileExtension=".json" mimeType="application/json" /> </staticContent>Check DNS and virtual host configuration. A domain pointing to the wrong server or a missing virtual host entry causes 404 for all paths. Verify the DNS A/CNAME records resolve to the correct server IP and the server has a matching
server_name(nginx) orServerName(Apache) directive.Audit broken links with a crawler. Run a site crawler to detect all 404 responses across the site. Fix broken internal links and submit an updated XML sitemap to search engines to accelerate re-indexing of moved content.
Code references
.NET
HttpStatusCode.NotFound
Rust
http::StatusCode::NOT_FOUND
Rails
:not_found
Go
http.StatusNotFound
Symfony
Response::HTTP_NOT_FOUND
Python3.5+
http.HTTPStatus.NOT_FOUND
Java
java.net.HttpURLConnection.HTTP_NOT_FOUND
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_NOT_FOUND
Angular
@angular/common/http/HttpStatusCode.NotFound
Takeaway
The 404 Not Found status code is a client error indicating a resource was not found at the specified address. The most likely cause is a dead link or a misspelled URL.
See also
- RFC 9110: HTTP Semantics
- Google: HTTP status codes and network errors
- Soft 404
- 410 Gone
- 400 Bad Request
- 403 Forbidden
- HTTP status codes