# 404 Not Found

> The server is working and answered you — it just has nothing at the address you asked for.

Source: https://cwp.sg/errors/404-not-found/  
Author: Ben Johnson  
Last verified: 2026-08-04

**Also seen as:** Page not found, The requested URL was not found on this server

## What it means

A `404` means the server received your request, understood it, and found no file or route matching that URL.

This is a *healthy* response. The server is up, DNS resolved, and your connection worked. Compare that with [403 Forbidden](/errors/403-forbidden/), which means the thing exists but you may not have it, and [500](/errors/500-internal-server-error/), which means the server broke while trying.

On a brand new hosting account, a `404` usually means the file is not where you think it is. On an established site, it usually means a rewrite rule stopped working.

## Why it happens

### The file is in the wrong directory

Files must be inside the web root — `htdocs`, `public_html` or `www` depending on the host. Uploading a *folder* rather than its contents is the classic version: `htdocs/mysite/index.html` serves at `/mysite/`, not at `/`.

### The filename case does not match

Linux servers are case sensitive. `About.html` and `about.html` are different files. This bites hardest when moving a site from Windows or macOS, where it worked locally because those filesystems are usually case-insensitive.

### Pretty URLs lost their rewrite rules

WordPress and most frameworks serve every page through one front controller, using `.htaccess` rules to route the request. If that file is missing, empty, or the server is ignoring it, the homepage works and every other page returns `404`.

**That specific symptom — homepage fine, everything else 404 — is almost always this.**

### The page genuinely moved

A restructure, a changed slug, or a deleted post. The URL is still linked from elsewhere, so people and search engines keep asking for it.

## How to fix it

### 1. Check the file is really there, and really named that

Open the file manager or connect over FTP and look at the actual path. Compare it character by character with the URL, including capitals.

Your homepage must be `index.html` or `index.php`, in lower case.

### 2. Regenerate the rewrite rules

If the homepage works but nothing else does, this is your fix.

On WordPress: go to **Settings → Permalinks** and click **Save Changes** without altering anything. That rewrites `.htaccess` with the correct rules.

If that does not work, check the file exists and contains the standard block:

```apache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
```

One caveat worth knowing: **nginx ignores `.htaccess` entirely.** If your host runs plain nginx, these rules do nothing and the routing must be configured server-side.

### 3. Redirect old URLs rather than deleting them

If a page moved, send visitors and search engines to the new one with a permanent redirect:

```apache
RewriteEngine On
RewriteRule ^old-page/?$ /new-page/ [L,R=301]
```

The [.htaccess generator](/tools/htaccess-generator/) will build these for a list of moved URLs.

Redirect to the closest equivalent page, not blanket to the homepage — a homepage redirect is treated as a soft 404 and helps nobody.

### 4. Serve a useful 404 page

You cannot prevent every 404, so make the ones you get helpful:

```apache
ErrorDocument 404 /404.html
```

A good 404 page says what happened, offers search, and links to the main sections. Do **not** redirect 404s to the homepage — it hides the problem from you and confuses visitors.

## On CWP hosting specifically

On CWP your web root is `htdocs`. A newly created account with no files serves a [403](/errors/403-forbidden/) rather than a 404, because the directory exists but is empty — upload an `index.html` and it resolves.

We run LiteSpeed, which reads `.htaccess` natively, so standard WordPress and framework rewrite rules work without modification.

---

Content Website Platform (cwp.sg) operates the free hosting it writes about; see https://cwp.sg/about/ for the methodology and the commercial disclosure.
