Skip to content

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

What the HTTP 404 Not Found error means and how to fix it: find broken URLs, 301 redirects, rewrite rules, WordPress, React and custom 404 pages.

Category
Web Servers
Covers
Apache, Nginx, WordPress
On this page

An HTTP 404 Not Found error means the server is working, but it couldn’t find anything at the address you asked for. The page may have been deleted or moved, the link may be wrong, or the URL may have a typo. It is the most common error on the web, and almost every site returns it many times a day.

This guide explains what the 404 status code means, how it differs from similar codes, and how to fix it. It covers quick checks for visitors, then step-by-step fixes for site owners running Apache, Nginx, WordPress and single-page apps.

What Does 404 Not Found Mean?

The HTTP standard (RFC 9110) says a 404 means the server “did not find a current representation for the target resource or is not willing to disclose that one exists.” In plain words: there’s nothing at this URL, or the server won’t tell you if there is.

A 404 is a 4xx client error. The server and your connection are fine. The problem is the address that was requested. You may see it worded in different ways:

  • 404 Not Found
  • HTTP Error 404 or Error 404 - Page Not Found
  • The requested URL was not found on this server. (Apache)
  • 404 Not Found nginx
  • HTTP Error 404.0 - Not Found (Microsoft IIS)
  • A custom page such as “Oops! We can’t find that page.”

404 vs 410, 403 and Soft 404

CodeMeaningWhen to use it
404 Not FoundNothing at this URL (maybe temporarily)The default for any missing page.
410 GoneThe page existed and was removed on purpose, for goodContent you deleted and won’t bring back. Search engines drop it a little faster.
403 ForbiddenThe page exists, but you aren’t allowed to see itAccess control. See our 403 Forbidden guide.
301 Moved PermanentlyThe page lives at a new URLMoved or renamed content. Redirect instead of showing a 404.
“Soft 404”The page says “not found” but returns 200 OKNever on purpose. Google treats these as errors.

To check what a URL really returns, use curl:

curl -s -o /dev/null -w "%{http_code}\n" https://example.com/old-page/

Common Causes of a 404 Error

  1. The page was deleted or moved without a redirect from the old URL.
  2. A typo in the URL, in the browser or in a link on another page.
  3. Broken internal or external links that point to an old address.
  4. Case-sensitive paths: on Linux servers, /About.html and /about.html are different files.
  5. Rewrite rules not working: pretty URLs (like WordPress permalinks or Laravel routes) need mod_rewrite on Apache or a try_files rule on Nginx.
  6. A wrong document root in the virtual host, so the server looks in the wrong folder.
  7. Single-page apps (React, Vue, Angular): routes work when you click through the app but return 404 when you reload or open them directly.
  8. Missing assets: images, CSS or JS files that were renamed or not deployed.

Quick Fixes If You’re Visiting the Site

  1. Check the URL for typos, extra characters or a missing part of the path.
  2. Reload the page in case a link was mid-update.
  3. Go up one level: remove the last part of the URL after the final / to reach the section page.
  4. Use the site’s search or its homepage menu to find the content.
  5. Search for the page title in a search engine. The page may have moved.
  6. Check an archived copy on the Internet Archive’s Wayback Machine (web.archive.org) if the page was removed.

How to Fix 404 Errors on Your Own Site

Step 1: Find which URLs return 404

Your web server’s access log records every 404. This one-liner lists the most requested missing URLs in an Nginx or Apache access log (the status code is field 9 in the default log format):

sudo awk '$9 == 404 {print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20

On Apache, the log is /var/log/apache2/access.log (Ubuntu, Debian) or /var/log/httpd/access_log (RHEL-based systems). In Google Search Console, open Indexing → Pages and look at the Not found (404) reason to see the URLs Google found.

Step 2: Check that the file exists and the path is right

For static files, confirm the file is in the document root and the name matches exactly, including upper and lower case:

ls -l /var/www/example.com/public/about.html
grep -R "DocumentRoot" /etc/apache2/sites-enabled/
grep -R "root " /etc/nginx/sites-enabled/

When Nginx can’t find a file, the error log says so directly, with the full path it tried:

open() "/var/www/html/about.html" failed (2: No such file or directory)

If that path isn’t where your files are, fix the root (Nginx) or DocumentRoot (Apache) setting.

Step 3: Redirect moved pages with a 301

When you move or rename a page, send the old URL to the new one with a permanent redirect. Visitors and search engines then land on the right page, and the old URL’s ranking passes to the new one.

Apache (in the virtual host or .htaccess):

Redirect 301 /old-page/ https://example.com/new-page/

Nginx (inside the server block):

location = /old-page/ {
    return 301 https://example.com/new-page/;
}

Test the Nginx config and reload it:

sudo nginx -t && sudo systemctl reload nginx

For more redirect patterns, see how to set up a 301 redirect with .htaccess.

Step 4: Fix rewrite rules for pretty URLs

If the homepage works but every inner page returns 404, the rewrite rules aren’t being applied.

Apache: enable mod_rewrite and allow .htaccess overrides for the site directory (AllowOverride All in the virtual host), then restart Apache. See how to enable mod_rewrite:

sudo a2enmod rewrite
sudo systemctl restart apache2

Nginx doesn’t read .htaccess. For PHP apps such as WordPress and Laravel, send requests for missing files to index.php:

location / {
    try_files $uri $uri/ /index.php?$args;
}

Step 5: Fix 404s on page reload in single-page apps

React, Vue and Angular apps handle routes in the browser. The server only has index.html, so a direct request for /dashboard returns 404. Tell the server to fall back to index.html:

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

We cover this in detail for React apps on Apache and Nginx and for S3 and CloudFront.

Step 6: Show a helpful custom 404 page

A good 404 page keeps visitors on your site: a short message, a search box and links to popular pages. It must still return the 404 status code.

# Apache
ErrorDocument 404 /404.html

# Nginx
error_page 404 /404.html;
location = /404.html {
    internal;
}

See how to create a custom 404 page on Apache for a full example.

Fixing 404 Errors in WordPress

  • All posts return 404, but the homepage works: go to Settings → Permalinks and click Save Changes without changing anything. WordPress rebuilds its rewrite rules and, on Apache, rewrites .htaccess if it can.
  • On Nginx, make sure the try_files $uri $uri/ /index.php?$args; line from Step 4 is in your server block.
  • After changing a post’s slug, WordPress usually redirects the old URL automatically. For other moved content, use a redirect plugin or server-level 301s.
  • After a migration, check the WordPress Address and Site Address in Settings → General, and that the files and .htaccess were copied.

Do 404 Errors Hurt SEO?

Not by themselves. Google says 404s are a normal part of the web and won’t hurt the rest of your site’s rankings. A URL that keeps returning 404 is eventually dropped from the index, which is correct for content that’s really gone.

What does cost you is:

  • Losing valuable pages: if a page with backlinks or traffic now returns 404, redirect it to the closest matching page with a 301.
  • Broken internal links: they waste crawl budget and frustrate visitors. Fix the links themselves.
  • Soft 404s: a “not found” page that returns 200 OK, or redirecting every missing URL to the homepage. Google reports both as soft 404s. Return a real 404 (or 410) for content that doesn’t exist, and only redirect URLs that have a true replacement.

For the full list of codes and what they mean, see our HTTP status codes list. Guides for other common errors:

Frequently Asked Questions

What does error 404 mean?

It means the server couldn’t find a page at that address. The site is working, but the specific URL doesn’t exist, usually because the page was moved or deleted, or the link has a typo.

Is a 404 error my fault?

Usually not. Check the URL for typos first. If it’s correct, the site has removed or moved the page, and only the site owner can fix the link.

What is the difference between 404 and 410?

404 means “not found”, with no promise about the future. 410 Gone means the page was removed on purpose and won’t come back. Both remove the URL from search results; 410 is a slightly stronger signal.

Should I redirect all 404 pages to the homepage?

No. Search engines treat mass redirects to the homepage as soft 404s, and visitors get confused. Redirect only URLs that have a real replacement, and show a helpful 404 page for the rest.

Why do I get 404 when I refresh a React or Vue page?

The server doesn’t know your app’s routes. Configure it to serve index.html for any path that isn’t a real file, using try_files $uri $uri/ /index.html; on Nginx or a rewrite rule on Apache.

Look for 404 entries in your access log, check the Not found (404) report in Google Search Console, or run a link checker such as wget --spider -r against your site.

Conclusion

An HTTP 404 Not Found error simply means nothing exists at the requested URL. For visitors, the fix is usually checking the address or searching the site. For site owners, find the missing URLs in your access log or Search Console, redirect moved pages with a 301, fix rewrite rules for pretty URLs and single-page apps, and serve a helpful custom 404 page that still returns the 404 status code.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top