# WordPress 404 errors after migration: fix

URL: https://wp24x7.com/fix/wordpress-404-after-migration/
Updated: 2026-11-29
Type: page
Audience: site owners whose pages return 404 after a move

> If your home page works after a WordPress migration but every other page says Not Found, pretty permalinks are not being routed on the new server. Re-save permalinks first. If that fails, the missing piece is usually a hidden .htaccess file on Apache or LiteSpeed, or a rewrite rule in the Nginx configuration. Your content is almost always safe in the database.

## Key facts

- For: owners whose site shows 404 on inner pages after a host or domain move
- Fastest test: Settings, then Permalinks, then Save Changes
- Usual causes: missing .htaccess, Nginx without a rewrite rule, wrong site address
- Safe check: /?p=ID opening the page proves content and database are fine
- Help: migration service, or emergency support with a 15-minute response
- Pricing: rescue is pay-only-if-fixed; the quote comes before work starts

If your home page works after a migration but other pages say "Not Found", WordPress's pretty permalinks are not being routed. **Re-save permalinks first; if that fails, the new server is missing its rewrite rules.**

## What does this error mean?

With pretty permalinks, a URL like `/about/` does not match a real file. The server must hand it to WordPress's `index.php`, which finds the page. That needs a rewrite rule. A migration can leave the old rules behind, or the new server may not have rewriting enabled.

## What are the common causes?

| Cause | Where it happens | Fix |
|:--|:--|:--|
| Rewrite rules not flushed | WordPress | Re-save permalinks |
| Missing or incomplete `.htaccess` | Apache or LiteSpeed | Recreate the standard block |
| No WordPress rewrite rule | Nginx | Host adds a `try_files` line |
| `mod_rewrite` off or `AllowOverride` blocking | Apache | Host enables it |
| Wrong WordPress or Site Address | Settings, General | Correct domain and protocol |
| Subfolder install with root rules | `.htaccess` | Rules written for the subfolder |

## What are the safe steps?

Back up files and database first.

1. **Re-save permalinks.** In wp-admin, go to Settings, then Permalinks, and click Save Changes without changing anything.
2. **Check the rewrite rules** for your server (see the tabs below).
3. **Check the addresses.** Under Settings, General, confirm WordPress Address and Site Address match the new domain and protocol.
4. **Temporarily switch to Plain permalinks.** If pages load with `?p=123` URLs, rewriting is the issue, not your content. Switch back afterwards.
5. **Test a few URLs,** including a post, a category and a custom post type.

## Which rewrite rule does my server need?

### Apache or LiteSpeed
Check the `.htaccess` file in the WordPress root. For a standard single-site install it should contain this block. If the file is missing, create it with that content, copying any other custom rules over first.

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

Ask the host to confirm `mod_rewrite` and `AllowOverride All` for your folder.
### Nginx
Nginx ignores `.htaccess`. The host or developer adds this line to the site's `location /` block:

```nginx
try_files $uri $uri/ /index.php?$args;
```

## How do I tell which cause I have?

First, does a plain link such as `/?p=1` open the right post? If yes, content and database are fine and routing is the problem. Second, which server runs the site? Ask your host, because the fix differs. Third, are the addresses correct? A site still pointing at the old domain can produce 404s or send you back to the old server. If posts work but custom post types or WooCommerce pages 404, re-save permalinks again. If only images 404, the uploads folder may not have been copied, which is a file transfer problem.

> **Two things to avoid**
Do not run a plain text replace of the old domain across the database, because serialised data breaks when lengths change. Do not leave the old site live on the same domain while you test.

## A short worked example

You moved a site on the same domain and `/about/` shows a 404. You open `/?p=` plus the About page ID and it loads, so the database is fine. Re-saving permalinks changes nothing, so you check the WordPress root over SFTP and find no `.htaccess`, because the dot file was skipped in the copy. You create it with the standard block and the pages return. Hidden files are the commonest casualty of a manual move.

## How do I confirm the fix?

1. Open a post, a page, a category and a custom post type URL in a private window.
2. Check images and downloads load from the uploads folder.
3. Submit a form and test login.
4. Spot-check URLs from your sitemap; they should return 200.
5. If you changed address or protocol, check old addresses redirect rather than 404.

A host cache can keep serving a stored 404 after the cause is fixed, so ask for it to be cleared.

## When should I stop and call someone?

Stop if you do not control server configuration, if there are redirects to the old domain you cannot find, if only some URLs fail, or if the database still holds old URLs that need a careful search-and-replace.

_Moving without downtime means rewrite rules move too_

## How do we fix it?

Our [migration service](/wordpress-migration-service) handles the move including redirects and rewrites. [Emergency support](/wordpress-emergency-support) responds within 15 minutes with service credits if a live site is already broken, and rescue is pay-only-if-fixed.

## What do the symptoms tell me?

| What you see | What it suggests |
|:--|:--|
| Home page works, inner pages 404 | Rewrite rules missing or not flushed |
| `/?p=ID` opens the right page | Content and database are fine; routing is the problem |
| Posts work, custom post types 404 | Re-save permalinks; check the plugin that registers them |
| Images 404 | The uploads folder was not copied across |
| Redirects to the old domain | Wrong WordPress or Site Address, or old URLs in the database |

**Pages still returning 404?**
A person reads it, at any hour.
[Post a project](/post-project)
[Emergency support](/wordpress-emergency-support)

## Frequently asked questions

### Why does only the home page work?

The home page is served directly. Every other page relies on URL rewriting, which is often not configured on the new server, so the request never reaches WordPress.

### Do I have to re-save permalinks?

Usually it is the first thing to try. Saving the Permalinks screen makes WordPress rebuild its rewrite rules and, on Apache, rewrite .htaccess. It costs nothing and is reversible.

### My new host uses Nginx. Does .htaccess apply?

No. Nginx ignores .htaccess. The rewrite rule belongs in the server configuration, which your host or developer must change, typically with a try_files line in the location block.

### Will this hurt my search rankings?

Pages returning 404 can drop out of search while the problem lasts, so it is worth fixing quickly. Once pages return normally, search engines recrawl them.

### Why is there no .htaccess file after the move?

The file name starts with a dot, so it is hidden and easily skipped when files are copied manually. Create it with the standard WordPress block or re-save permalinks to have WordPress write it.

### How do I prove my content is not lost?

Open /?p= followed by a post or page ID. If it loads, the database and content are fine and the problem is URL routing, not data.

### Posts work but my shop or custom post type pages show 404. Why?

Re-save permalinks again, then check that the plugin that registers those types is active. Rewrite rules are rebuilt from whatever is registered at the time you save.

### Can I just search and replace the old domain in the database?

Not with a plain text replace. WordPress stores serialised data whose lengths change, and a blind replace can break it. Use a tool that understands serialisation, or ask someone who does.

### A host cache keeps showing the 404 after I fixed it. What now?

A host-level cache or reverse proxy can serve a stored 404. Ask the host to clear it and confirm whether a cache layer sits in front of your site.

### How do I stop this happening on the next move?

Copy hidden files explicitly, record the web server type before choosing a host, and re-save permalinks as part of the post-move checklist. Test the new host before switching the domain.

### Can you fix it for me?

Yes. The migration service handles the move including redirects and rewrites, and emergency support responds within 15 minutes if a live site is already broken.
