HTTP 404 Not Found Error: 7 Causes and How to Fix
The 404 Not Found error is one of the most common HTTP status codes site owners and visitors encounter. It means the server received the request but could not find the requested resource. Despite appearing simple, 404 can stem from many causes: a URL typo, broken rewrite rules, CDN cache issues, or SPA routing misconfiguration.
This guide covers what 404 really means, 7 common causes, how to diagnose it using DevTools and server logs, and proven solutions for nginx, Apache, Next.js, WordPress, and React applications in 2026.
What HTTP 404 Not Found Means
According to RFC 9110 §15.5.5, 404 indicates the server cannot find a current representation of the target resource or is unwilling to disclose one exists. It is a client error (4xx class), though the root cause is often server-side configuration.
Distinguish 404 from related codes: 410 Gone (permanently removed), 301 Moved Permanently (relocated), and 403 Forbidden (access denied). Confusion between these hurts SEO — see our full HTTP status codes reference.
7 Common Causes of 404 Errors
- URL typo. Most frequent cause — user or external link has an incorrect path.
- Deleted or moved page. Content removed but no redirect configured.
- Broken rewrite rules. Misconfigured
try_filesin nginx or.htaccessin Apache. - File permission problems. Web server cannot read the file due to wrong chmod/chown.
- SPA routing errors. React/Vue/Angular apps without
index.htmlfallback return 404 on direct navigation. - Stale CDN cache. CDN serves old 404 after you deploy the new page.
- DNS or upstream misrouting. Request hits the wrong origin server.
Diagnosing 404 with DevTools and Logs
Open DevTools (F12 → Network tab), reproduce the error, and inspect the full request: URL, method, headers. The Referer header reveals where the broken link originated.
For fast header inspection, use the Enterno.io HTTP Header Checker — paste a URL and get the full response headers plus redirect chain.
From the command line:
curl -I https://example.com/broken-page
curl -v https://example.com/broken-page 2>&1 | head -50Check web server logs:
# nginx
tail -f /var/log/nginx/access.log | grep " 404 "
tail -f /var/log/nginx/error.log
# Apache
tail -f /var/log/apache2/access.log | grep " 404 "
tail -f /var/log/apache2/error.logSolutions by Platform
nginx: try_files and custom error page
server {
location / {
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404.html;
location = /404.html {
internal;
}
}Apache (.htaccess)
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
ErrorDocument 404 /404.htmlWordPress
Go to Settings → Permalinks and click Save — this rewrites .htaccess. If that fails, check file permissions: chmod 644 .htaccess.
React / Vue / Next.js SPA
For static hosting, set up index.html fallback:
# nginx
location / {
try_files $uri $uri/ /index.html;
}301 redirects for deleted pages
Return 301 instead of 404 when content moved — preserves SEO equity:
location = /old-url {
return 301 https://example.com/new-url;
}Preventing 404 Errors
- Scan regularly for broken links — at minimum monthly.
- Monitor key pages via Enterno.io Uptime Monitoring — get alerts if a page suddenly returns 404.
- Use 301 redirects for any URL structure changes.
- Watch Google Search Console — the Coverage report lists every 404 Googlebot hit.
- Build an informative 404 page with site search, popular links, and a contact form.
Frequently Asked Questions
Q: Does 404 hurt SEO?
A: Isolated 404s are fine. Mass 404s on previously indexed pages reduce crawl budget and rankings. Google recommends 410 for intentionally removed content.
Q: Should I use 404 or 410?
A: Use 410 Gone when content is permanently deleted. Use 404 for unknown or temporary cases. Googlebot deindexes 410 faster.
Q: Can I detect 404s automatically?
A: Yes — use Enterno.io monitoring with expected_code=200. Any deviation triggers Email/Telegram/Slack alerts.
Q: Why does deploying a new page return 404?
A: Three usual suspects: (1) CDN cache — purge it, (2) PHP OPcache — restart php-fpm, (3) rewrite rules not reloaded — reload nginx/apache.
Conclusion
A 404 is not a verdict, it is a signal. In 90% of cases it is fixed within 5 minutes after proper diagnosis via DevTools, logs, and the HTTP Header Checker. Key principles: set up 301 redirects when URLs change, monitor for broken links, craft a useful 404 page, and enable automatic monitoring of critical pages.
Check your website right now
Check now →