HTTP 404 Not Found
The server can’t find anything at the requested URL.
Meaning
A 404 means the server is reachable but there is no resource at that path. It may never have existed, it moved without a redirect, or the server’s routing isn’t sending the request to your application.
For single-page apps and frameworks with “pretty URLs”, a 404 on page refresh almost always means the web server isn’t rewriting unknown paths to index.html / index.php.
Common causes
- Typo or wrong case in the URL (paths are case-sensitive on Linux)
- Page or file was moved/deleted without a 301 redirect
- Missing rewrite rules — SPA/framework routes 404 on refresh
- Wrong document root or base path (app deployed in a sub-folder)
- API route not registered, or wrong HTTP method mapped to a different route
.htaccessnot applied becauseAllowOverride None- Some APIs return 404 instead of 403 to hide resources you can’t access
⚡ Quick fix
- Double-check the exact URL, including case and trailing slash
- Add a fallback rewrite to
index.html/index.phpfor SPA and framework routes - Confirm the server’s document root points to the right folder
- For moved pages, add a 301 redirect from the old URL
- List your framework’s registered routes (
php artisan route:list,rails routes)
Detailed fix by platform
Nginx
- Send unknown paths to your app:nginx
location / { try_files $uri $uri/ /index.html; # SPA # try_files $uri $uri/ /index.php?$query_string; # PHP frameworks }
Apache
- Enable mod_rewrite (
sudo a2enmod rewrite) and setAllowOverride Allfor the directory. - Front-controller fallback in
.htaccess:apacheRewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [L,QSA]
React
- With React Router, configure the host to serve
index.htmlfor all routes (Netlify_redirects:/* /index.html 200; Vercel rewrites). - If deployed under a sub-path, set
basenameon the router andhomepage/basein the build config.
WordPress
- Re-save Settings → Permalinks to regenerate rewrite rules.
- Check that
.htaccessis writable and mod_rewrite is enabled.
Code examples
Check how the server sees the path
bash
curl -I https://example.com/dashboard
curl -I https://example.com/Dashboard # case matters on LinuxHow to diagnose
- URL — Exact path, case, trailing slash, sub-folder?
- Static file — Does the file exist under the document root?
- Routing — Does the web server rewrite to the app front controller?
- App routes — Is the route registered for this method?
- History — Was the page moved? Add a 301.
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026