# 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.

Canonical: https://scaplet.com/errors/http/404/apache

Guide Error · HTTP status codes

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

404 4xx · Client error

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](#how-apache-decides-a-url-is-not-found)
2. [Common Apache causes and fixes](#common-apache-causes-and-fixes)
3. [Trace the request](#trace-the-request)
4. [What it does to SEO](#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 with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F404%2Fapache%20(%22404%20Not%20Found%20on%20Apache%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F404%2Fapache%20(%22404%20Not%20Found%20on%20Apache%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F404%2Fapache%20(%22404%20Not%20Found%20on%20Apache%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F404%2Fapache%20(%22404%20Not%20Found%20on%20Apache%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

_01_Explained

## How Apache decides a URL is not found

By default, httpd takes the [URL path](/glossary/url-slug) 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](/errors/http/404).

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.

_02_Apache 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
```

_03_How 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](/glossary/http-status-codes), 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.

_04_Explained

## 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](/glossary/google-search-console) after the deploy. See [4xx errors](/seo-issues/4xx-errors) for the audit steps. The [nginx variant](/errors/http/404/nginx) 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.

_01_ How 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.

_02_ Why 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.

_03_ How 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`.

_04_ Why 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. 01 [Core Features - Apache HTTP Server 2.4](https://httpd.apache.org/docs/2.4/mod/core.html) httpd.apache.org · checked 2026-10-25
2. 02 [Mapping URLs to Filesystem Locations - Apache HTTP Server 2.4](https://httpd.apache.org/docs/2.4/urlmapping.html) httpd.apache.org · checked 2026-10-25
3. 03 [mod_rewrite - Apache HTTP Server 2.4](https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html) httpd.apache.org · checked 2026-10-25
4. 04 [mod_dir - Apache HTTP Server 2.4](https://httpd.apache.org/docs/2.4/mod/mod_dir.html) httpd.apache.org · checked 2026-10-25
5. 05 [404 Not Found - HTTP - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/404) developer.mozilla.org · checked 2026-10-25
6. 06 [How HTTP status codes affect Google's crawlers](https://developers.google.com/crawling/docs/troubleshooting/http-status-codes) developers.google.com · checked 2026-10-25
7. 07 [RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html) rfc-editor.org · checked 2026-10-25

## Keep learning

[All errors](/errors)

[Learn 404 Not Found HTTP status codes](/errors/http/404) [Related 4xx errors Status codes and links](/seo-issues/4xx-errors) [Read next 404 Not Found on nginx HTTP status codes](/errors/http/404/nginx) [Do Run a free site audit Free, about two minutes](/site-audit)

Other 404 errors
[404 Not Found in Flask](/errors/http/404/flask) [404 Not Found in IIS](/errors/http/404/iis) [404 Not Found in WordPress](/errors/http/404/wordpress) [404 Not Found on nginx](/errors/http/404/nginx) [AWS Amplify 404 Not Found](/errors/cdn/amplify-404)

Nearby in errors
[403 Forbidden in WordPress](/errors/http/403/wordpress) [404 Not Found](/errors/http/404)

More in 404 Not Found
[404 Not Found caused by .htaccess](/errors/http/404/htaccess) [404 Not Found in Django](/errors/http/404/django) [404 Not Found in Flask](/errors/http/404/flask) [404 Not Found in IIS](/errors/http/404/iis) [404 Not Found in WordPress](/errors/http/404/wordpress) [404 Not Found on Apache](/errors/http/404/apache) [404 Not Found on nginx](/errors/http/404/nginx)

Terms on this page
[URL slug](/glossary/url-slug) [HTTP status codes](/glossary/http-status-codes) [Google Search Console](/glossary/google-search-console)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

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

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
