Free auditStart free
GuideError · HTTP status codes

404 Not Found on Apache

Apache returns 404 Not Found when the URL does not map to a file. Check DocumentRoot, Alias, .htaccess rewrites and AllowOverride, then fix the path or rule.

4 min
read
7
sources
Oct 24, 2026
updated
Scaplet Editorial Team
author
The short answer

A 404 Not Found from Apache means httpd could not map the URL to a file or handler. Common causes are a file missing under the DocumentRoot, rewrite rules in .htaccess that are not being read because AllowOverride is None, or a wrong Alias. Read the error log, compare the URL to the file path, then fix the mapping.

  1. How Apache decides a URL is not found
  2. Common Apache causes and fixes
  3. Trace the request
  4. What it does to SEO
30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01Explained

How Apache decides a URL is not found

By default, httpd takes the URL path of the request and adds it to the end of the DocumentRoot. With a DocumentRoot of /var/www/html, a request for /fish/guppies.html is served from /var/www/html/fish/guppies.html, as the Apache URL-mapping guide describes. Directives like Alias, RewriteRule and ProxyPass change that. If nothing maps to a file or a handler, Apache returns 404. The general meaning of the code is on the 404 Not Found page.

The Apache guide names two common causes of "File Not Found" errors: documents moved from one location to another, and mistyped URLs, whether in the browser or in HTML links. For moved documents it advises URL redirection, so that old bookmarks and links keep working.

02Apache causes of 404

Common Apache causes and fixes

Cause

File is not under the DocumentRoot

Where to look
The DocumentRoot of the matching virtual host
Fix
Move the file, or set DocumentRoot or an Alias to the right directory
Cause

Wrong virtual host answers

Where to look
ServerName and ServerAlias of each host
Fix
Match the host in the request to the host you configured
Cause

.htaccess rules ignored

Where to look
AllowOverride for the directory
Fix
Set it to All or to the groups you need, such as FileInfo for rewrites
Cause

Rewrite rule sends the request to a missing file

Where to look
RewriteRule and RewriteCond lines
Fix
Test with the rewrite log and fix the pattern or condition
Cause

Filename case mismatch

Where to look
The file on disk against the URL
Fix
Rename the file, or enable mod_speling, which compares filenames without respect to case (the docs warn it adds load when used for more than occasional corrections)
Cause

Page moved without a redirect

Where to look
Your deploy history
Fix
Add a Redirect or RewriteRule from the old URL to the new one

The AllowOverride row catches many WordPress and framework sites. The Apache docs say that when AllowOverride is None (its default) and AllowOverrideList is None, .htaccess files are completely ignored, and the server will not even try to read them. The rules in .htaccess never run, so a site that relies on them for clean URLs can return 404 for every route that is not a real file.

Allow .htaccess rewrites in a directory
<Directory "/var/www/html">
    AllowOverride FileInfo
</Directory>

For a front controller, one line is enough: FallbackResource hands any URL that maps to no file or handler to the script you name, and existing files are served normally. Its default is disabled, which returns 404. It needs AllowOverride Indexes in .htaccess. Earlier httpd versions needed mod_rewrite with -f (exists and is a regular file) and -d (is a directory) tests for the same effect.

FallbackResource front controller (mod_dir)
FallbackResource /index.php
03How it works

Trace the request

To show visitors something useful, set ErrorDocument 404 /errors/not-found.html. The directive can point at a local path, an external URL or a text message. Use a local path. Apache's docs warn that a remote URL makes it send a redirect, so the client does not receive the original error status code, which can confuse robots that check status codes.

  1. 01

    Confirm the status and host

    Run curl -sI -H 'Host: example.com' http://SERVER-IP/path to see which virtual host answers and with what status.

  2. 02

    Read the error log

    The ErrorLog directive sets its location. Raise LogLevel for mod_rewrite (for example LogLevel alert rewrite:trace3) to watch each rule apply, as the module's docs describe, and lower it again afterward.

  3. 03

    Check the file on disk

    Join the DocumentRoot and the URL path and look for that file. Check the case of every segment.

  4. 04

    Check for a matching `Alias`

    An Alias or ScriptAlias changes where a URL prefix is served from. Make sure its target path exists.

  5. 05

    Restart or reload and retest

    Reload Apache after config changes and repeat the same request.

04Explained

What it does to SEO

Google treats an Apache 404 like any other: it does not index the URL, and an already indexed URL that returns 404 is removed from the index. After a migration, a missing AllowOverride or a lost .htaccess can turn many working URLs into 404s at once, so compare Search Console after the deploy. See 4xx errors for the audit steps. The nginx variant covers the same error on the other common server.
Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01How can I fix a 404 Not Found error on Apache?

Read ErrorLog, then compare the URL with the file path under the DocumentRoot. Check the virtual host, any Alias, and whether .htaccess rules are read. Then fix the path or rule, reload Apache and retest.

02Why does Apache ignore my .htaccess file?

When AllowOverride is None, Apache completely ignores .htaccess files and does not read them. Set AllowOverride in the matching <Directory> block to All or to the directive groups you need.

03How do I make a custom 404 page in Apache?

Use ErrorDocument 404 /path/to/page.html. Use a local path. A full external URL makes Apache send a redirect, so clients do not receive the 404 status. The directive works in server config, virtual host, directory and .htaccess.

04Why do I get 404 for a file that exists?

Check the case of the filename, the virtual host that answers, and whether an Alias or rewrite rule points elsewhere. A different host or a rewrite that targets a missing file is more common than a missing upload.

Sources · 7

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • apache.org
  • mozilla.org
  • google.com
  • rfc-editor.org
  1. 01Core Features - Apache HTTP Server 2.4httpd.apache.org · checked 2026-10-25
  2. 02Mapping URLs to Filesystem Locations - Apache HTTP Server 2.4httpd.apache.org · checked 2026-10-25
  3. 03mod_rewrite - Apache HTTP Server 2.4httpd.apache.org · checked 2026-10-25
  4. 04mod_dir - Apache HTTP Server 2.4httpd.apache.org · checked 2026-10-25
  5. 05404 Not Found - HTTP - MDN Web Docsdeveloper.mozilla.org · checked 2026-10-25
  6. 06How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-10-25
  7. 07RFC 9110: HTTP Semanticsrfc-editor.org · checked 2026-10-25
Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane