WordPress 404 on all pages except the homepage after a move: Apache, Nginx and what to check

When only the homepage works after moving WordPress and every other page shows a 404, the content is usually intact. What is missing are the rules that translate a pretty address into the right post. On Apache and LiteSpeed the .htaccess file handles this, on Nginx the server configuration. Start by saving the permalinks again, then check the server.

Author: The TellMyShop team. A guide for WordPress site and WooCommerce store owners: the cause, the manual fix and the same work in a chat conversation.
Last updated: · 7 min read

How you know it is this problem and not an ordinary 404

This article covers one specific situation: all pages suddenly stopped working, most often right after moving the site to another host, changing the domain or restoring a backup. Single addresses with an error, for example after deleting a post or changing one page's permalink, are a different problem. We describe it in the guide to the 404 error in WordPress.

Symptoms that fit a move:

SymptomWhat it probably means
The homepage works, posts, pages and categories give a 404no URL rewrite rules on the server
The /wp-admin dashboard works normallyWordPress and the database are fine
An address with /index.php/ in the middle opens the postWordPress works, the server doesn't pass pretty addresses to it
The 404 message looks different from the theme's 404 pagethe server returns the error itself, before WordPress gets the request
Links lead to the old domain or a test addressthe old address is still in the site settings

The last row is worth checking separately. If the menu and links lead to the old address, the problem lies in the site settings, not in the server rules.

A step-by-step rescue guide

The steps go from the simplest to the one you leave to your host. After each one, check one post and one page in a private browser window.

  1. Save the permalinks again. Go to Settings, Permalinks and click Save Changes without changing anything. WordPress rebuilds the URL rules and tries to write them to .htaccess. The Permalinks settings documentation describes the screen.
  2. Read the message after saving. If WordPress shows a box with rules to paste in by hand, it couldn't write the file. Copy those rules for your host or paste them in yourself in the file manager.
  3. Check the site address. In Settings, General, the WordPress Address and Site Address fields must have the new domain and the right beginning (https or http, with or without www). If the old addresses are there, don't fix them blindly, because you can lose access to the dashboard. Better ask whoever looks after the site.
  4. Find out what server the site runs on. Apache or LiteSpeed: go on to step 5. Nginx: step 6.
  5. Apache and LiteSpeed: look at .htaccess. In the hosting file manager, in the site folder, turn on showing hidden files. The file name starts with a dot, and when copying over FTP it often simply stays behind on the old server. It should contain a block between the lines “# BEGIN WordPress” and “# END WordPress”.
  6. Nginx: ask your host for a WordPress rule. Nginx doesn't read .htaccess, and WordPress won't add the rules itself. Write to your host that you need a configuration that passes non-existent addresses to index.php.
  7. Clear the cache. A cache plugin or the host's cache can keep showing old 404s for a while, even when the rules already work.

Apache or Nginx: who fixes what

The difference between servers decides whether you can manage yourself or need to write to your host.

Apache and LiteSpeed read the .htaccess file from the site folder. When the file is in place and has the WordPress block, but pages still give a 404, the server may have the rewrite module turned off or a setting that tells it to ignore .htaccess. Those are server settings, and your host changes them, not you.

Nginx has no equivalent of .htaccess. The WordPress documentation on Nginx configuration says plainly that WordPress won't change this server's configuration itself, so without a manual rule, index.php gets added to addresses. Your host or the server administrator adds the rule. Many hosts have a ready WordPress template in the panel that you just need to turn on.

With an installation in a subfolder, for example when the blog sits under /blog/, the rules have to point to that subfolder. This is a common trap after moving a site from the root folder into a subfolder or the other way round. The same case, with a precise description of the “everything but the homepage” symptom, is also covered in the WebNots guide.

What you can give your host in one email:

  • the domain and the fact that after the move only the homepage works,
  • two example addresses that give a 404,
  • whether the address with /index.php/ works,
  • the WordPress block from .htaccess, or the fact that the file is missing.

How the chat helps find the cause

The TellMyShop plugin for WordPress and WooCommerce doesn't edit the .htaccess file or the server configuration. That is a deliberate block, and no switch lifts it. It is still useful for a quick diagnosis when the connection to your chat (Claude or ChatGPT) works, and for checking that everything is back after the fix. If the chat can't connect to the site, go through the rescue guide by hand.

In the free TellMyShop Free the chat opens chosen addresses the way a browser does and shows the response code, and reviews the site health, the error log and the 404 report. Within minutes you know whether the problem affects all pages or only some, and exactly what to pass on to your host.

You: We moved the site to a new host and I think something is broken. Check the pages.

Your chat: I checked six addresses. The homepage responds with code 200. The post “How to choose a planter”, the Contact page and the Tips category respond with 404, and the same content opens with /index.php/ in the address.

Your chat: Site health: Nginx server. Conclusion: WordPress works, but the rule passing addresses to index.php is missing. I can't change that from the plugin. I've drafted an email to your host with the example addresses.

You: The host has added the rule. Check again.

Your chat: All six addresses respond with code 200. The 404 report for the last hour has no new entries.

Illustration: products, numbers and replies are examples.

The addresses and numbers in this conversation are illustrative. In TellMyShop Pro the chat reads the whole site, so it can also compare addresses in the menu and links with the new domain. Changing the permalink settings from the conversation needs the Theme switch in Pro, which lasts 24 hours and requires a database backup from today. Every save has a preview and waits for your approval, and you can undo most changes from the history. The details are on the TellMyShop for WordPress and WooCommerce page, and you can compare versions in the pricing.

After the fix: what to check so Google loses nothing

When the pages work again, three things remain.

The first is addresses. If the domain or the permalink structure changed during the move, the old addresses need 301 redirects, or links from other sites and Google results will lead nowhere. We explain how to set them up in the guide to the 301 redirect in WordPress.

The second is visibility. After a few days of 404s, some pages may have dropped out of results. If they don't come back after the fix, look for causes using the list in the article WordPress site not showing in Google.

The third is the 404 error report. For the first few days after the fix, look at it every day. New entries will show addresses nobody remembered, such as old links to files or categories that were renamed.

You can check response codes, site health and the 404 report in the free TellMyShop Free. You will find more guides on the blog.

Questions and answers

Why does only the homepage work after a move?

The homepage doesn't need URL rewrite rules, but pages with pretty addresses do. When the new server has no .htaccess file, ignores it, or runs Nginx without a rule for WordPress, every address except the homepage ends in a 404 error. The content in the database is intact.

Does saving the permalinks always help?

It helps when WordPress can write the .htaccess file itself on an Apache server. On Nginx this step changes nothing on the server, because Nginx doesn't read .htaccess. Then the rule has to be added by your host or whoever configures the server.

How do I check whether I have Apache or Nginx?

The simplest way is to ask your host or look at the plan description in the panel. WordPress also shows server information under Tools, Site Health, on the Info tab, in the server section. Hosts running LiteSpeed usually read .htaccess just like Apache.

Pages work with /index.php/ in the address. What does that mean?

It is a sign that WordPress works but the server isn't passing pretty addresses to it. A Nginx installation without a WordPress rule often looks like this. Don't switch the permalink structure to one with index.php permanently; ask your host to add the rule.

Do I need to set up redirects after the fix?

If the addresses didn't change, no. Google will come back to the same addresses and see the content. Redirects are only needed when the domain, the permalink structure or the addresses of some pages changed during the move.

WordPress is a trademark of the WordPress Foundation. WooCommerce is a trademark of Automattic Inc. Claude is a trademark of Anthropic PBC. ChatGPT and OpenAI are trademarks of OpenAI. TellMyShop is not affiliated with these companies.

TellMyShop for WordPress and WooCommerce

Your chat reads the site, shows every change before saving it and saves only after your yes. You can undo most changes with one sentence. Works with Claude or ChatGPT, free accounts included.

Read next