404
Not Found
4xx Client Error
What Does HTTP 404 Not Found Mean?
HTTP 404 is the most recognizable error on the internet. It means the server is running and reachable, but the specific resource the client requested does not exist at the given URL. The server could not find a page, file, API endpoint, or any other resource matching the requested path.
A 404 does not tell you why the resource is missing. It could be a typo in the URL, a deleted page, a moved resource without a redirect, or a link that was never valid. The server makes no distinction between these cases — it simply reports that nothing exists at that address.
Importantly, 404 is different from a connection error. If you get a 404, the server itself is working fine. The issue is specifically that the URL does not correspond to any content.
Common Causes
- Typo in the URL: A single mistyped character (
/aricles/instead of/articles/) leads to a 404. This is the most common cause for regular users. - Page was deleted without a redirect: Content was removed but no 301 redirect was set up to send traffic to a replacement page. Old bookmarks and external links now point to nothing.
- URL structure changed: A site redesign changed URLs from
/blog/2024/my-postto/posts/my-postwithout setting up redirect rules for the old format. - Case-sensitive file systems: Linux servers treat
/About.htmland/about.htmlas different files. A link using the wrong case hits a 404 even though the file exists. - Broken internal links or hardcoded paths: Templates or navigation menus reference pages that were renamed or reorganized. These broken internal links create a poor user experience and waste crawl budget.
How to Fix It
For Website Owners
- Audit and fix broken links: Use Google Search Console's "Pages" report or crawl tools like Screaming Frog to find all URLs returning 404. Fix internal links and set up 301 redirects for important external links.
- Set up 301 redirects for moved content: If a page moved to a new URL, add a 301 redirect so old links automatically resolve to the new location.
- Create a helpful custom 404 page: A good 404 page includes a search bar, links to popular pages, and clear navigation. Do not just show "Page Not Found" — help the user find what they were looking for.
- Use 410 Gone for permanently removed content: If you intentionally deleted a page and it will never return, use 410 instead of 404. This tells search engines to remove it from their index faster.
- Monitor and fix regularly: Set up alerts for new 404 errors, especially after deployments or content reorganizations.
For Regular Users
- Double-check the URL: Look for typos, extra characters, or missing path segments. Try removing everything after the domain to reach the homepage.
- Search the site: Use the site's search function or try
site:example.com your search termsin Google to find the content. - Try the Wayback Machine: If the page was deleted, web.archive.org may have a cached copy.
- Check if the entire site is down: If every page returns 404, the site may be misconfigured. Check back later or contact the site owner.
Code Examples
Custom 404 Page in Nginx
server {
listen 443 ssl;
server_name example.com;
# Custom 404 page
error_page 404 /404.html;
location = /404.html {
root /var/www/html;
internal;
}
}
Express.js 404 Handler
// API: Return JSON 404
app.use('/api', (req, res) => {
res.status(404).json({
error: 'not_found',
message: `No resource found at ${req.originalUrl}`,
suggestion: 'Check the API documentation at /api/docs'
});
});
// Web: Render 404 page (must be the LAST route)
app.use((req, res) => {
res.status(404).render('404', {
url: req.originalUrl,
searchUrl: `/search?q=${encodeURIComponent(req.path)}`
});
});
Apache .htaccess
# Custom 404 page
ErrorDocument 404 /404.html
# Redirect old URLs to new ones to prevent 404s
Redirect 301 /old-page.html /new-page.html
RedirectMatch 301 ^/blog/(\d{4})/(.*)$ /posts/$2
Detecting 404 with curl
$ curl -o /dev/null -s -w "%{http_code}" https://example.com/missing-page
404
# Get the full response
$ curl -i https://example.com/missing-page
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: 1245
Frequently Asked Questions
What does a 404 error mean?
A 404 error means the web server is running normally, but the specific URL you requested does not match any page or resource on the server. It is not a server outage — the server is responding. It simply cannot find anything at the address you specified. Common reasons: the page was deleted, the URL has a typo, or a link you followed is outdated.
How do I fix 404 errors on my website?
Start by finding all your 404 errors — check Google Search Console or run a crawl with Screaming Frog. For each broken URL: if the content moved, add a 301 redirect to the new URL. If the content was deleted intentionally, consider returning 410 Gone. Fix internal links that point to non-existent pages. Set up a helpful custom 404 page as a safety net. After fixing, submit a fresh sitemap.
Does a 404 error hurt SEO?
A small number of 404 errors is normal and will not hurt your rankings. However, if important pages with backlinks return 404, you lose the link equity those pages accumulated. Use 301 redirects to preserve link value. Excessive 404 errors also waste crawl budget. Google's guidance: 404s are fine for truly removed content, but use redirects when pages move to new URLs.