Guide WordPress

How to fix WordPress permalinks returning 404

The home page loads, but every post and page 404s. Almost always a permalinks or .htaccess problem, and almost always fixable in minutes.

Updated 6 min read Intermediate

When the WordPress home page loads normally but every post and page returns a 404 error, the cause is almost always the same: the server-level rewrite rules that translate a friendly URL like /about-us/ into the request WordPress actually understands are missing, broken, or not being applied. This is a permalinks problem, not a content problem — the pages still exist, the server just does not know how to find them from the URL you are requesting.

Why this happens

WordPress's "pretty" permalink structures — anything other than the plain, default query-string format — depend on a set of rewrite rules written into your .htaccess file. These rules are what tells the web server to hand a request like /about-us/ over to WordPress's own routing, rather than looking for a literal file or folder called about-us. If that file is missing, has been overwritten, or has had its WordPress-specific block removed, the server has no idea what to do with the request and returns a 404 instead.

This commonly follows one of a few events: a migration that did not carry .htaccess across, a theme or plugin that rewrote the file and dropped WordPress's own rules in the process, or a manual edit that accidentally removed the relevant block.

This fixes the problem more often than any other single step, and it is the first thing to try in every case.

  1. Go to Settings → Permalinks

    You do not need to change the selected structure.

  2. Click Save Changes

    Even with nothing altered, saving this page makes WordPress regenerate its rewrite rules and write them into .htaccess again from scratch.

  3. Test a post and a page, not just the home page

    If this was the whole problem, individual pages now load correctly.

If wp-admin itself is unreachable

A 404 issue occasionally extends to wp-admin as well, in which case you cannot use the settings page at all. Skip ahead to editing .htaccess directly over FTP instead.

Step 2: confirm .htaccess exists and can be written to

Re-saving permalinks only works if WordPress can actually write to .htaccess. Connect over FTP or your control panel's file manager, enable hidden files if they are not already visible, and check the web root for a file named exactly .htaccess.

  • If it is missing entirely, create a new blank file with that exact name, then go back to Step 1 and re-save permalinks so WordPress can populate it.
  • If it exists but permalinks still fail after re-saving, check its file permissions. WordPress needs to be able to write to it, and overly restrictive permissions silently stop the update from taking effect even though the settings page shows no error.

Step 3: add the WordPress rewrite rules manually

If re-saving permalinks does not resolve it, the standard block WordPress expects to find can be added directly. Open .htaccess and confirm it contains this, exactly as shown, usually near the top of the file:

# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
If the site runs in a subfolder, RewriteBase needs to match

A WordPress install living at example.com/blog rather than the domain root needs RewriteBase /blog/ instead of RewriteBase /. A mismatch here produces exactly this same 404 pattern, so double-check the path if the site is not installed at the root.

Save the file and test again. If you are not confident editing .htaccess directly, back up the existing file first so you have something to restore from — see fixing a broken .htaccess file if an edit makes things worse rather than better.

Step 4: confirm mod_rewrite is actually enabled

Everything above assumes the Apache module responsible for interpreting these rules, mod_rewrite, is enabled on the server. On standard hosting this is normally on by default, so it is rarely the actual cause, but if the previous steps have not fixed the problem it is worth ruling out. Our support team can confirm this from the server side if you are unsure — contact us with the domain and what you have already tried.

After it is fixed

Test a range of page types, not just one post — a standard page, a blog post, and any custom page templates the theme uses, such as a shop or portfolio layout. Occasionally only one page type is affected rather than the whole site, which points at a plugin generating its own rewrite rules rather than a problem with the core WordPress ones covered here.

Frequently asked questions

Why does the home page work but nothing else does?

The home page is usually served directly, without needing a rewrite rule to interpret its URL. Every other page relies on the rewrite rules in .htaccess to translate a friendly URL like /about-us/ into the actual WordPress request behind it, so when those rules are missing or broken, only the home page keeps working.

Will changing permalink settings again break existing links?

Re-saving the same permalink structure you already use does not change any URLs, only rewrites the underlying .htaccess rules. Only actually choosing a different structure changes the URLs themselves, and that does break existing links unless redirects are set up to cover it.

Related reading