WebGee DocsDocs
WordPress

Reset WordPress permalinks

Fix pages returning 404 when the home page works, by regenerating the rewrite rules — from the dashboard, or by restoring .htaccess if you cannot log in.

When every page except the home page returns 404 Not Found, the rewrite rules in .htaccess are wrong or missing. Regenerating them fixes it. Applies to all shared and reseller hosting.

This is the classic symptom after a migration, a restore, or an edit to .htaccess that removed the WordPress block.

From the WordPress dashboard

WordPress rewrites .htaccess whenever you save the permalink settings, so saving twice regenerates the rules without changing anything.

  1. Log in to the WordPress dashboard.
  2. Go to SettingsPermalinks.
  3. Note the setting currently selected. If it is Custom Structure, copy the string somewhere safe first.
  4. Select Plain, then Save Changes. If Plain was already selected, choose Day and name instead. You should see Permalink structure updated.
  5. Select your original setting again and Save Changes. Wait for the second Permalink structure updated message.

Clear your browser cache before testing, and test in a private window — a cached 404 will otherwise convince you nothing changed.

If you cannot log in

Replace the WordPress block in .htaccess by hand. The file is in your document root, normally public_html, alongside wp-admin and wp-config.php.

Use cPanel's File Manager with Show Hidden Files enabled, or an FTP client.

# 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

Replace only the block between # BEGIN WordPress and # END WordPress. Overwriting the whole file discards anything else in it — redirects, security rules, caching directives and settings added by plugins.

If the file has no WordPress block at all, add this one at the top.

Once you can log in again, save the permalink settings from the dashboard so WordPress owns the rules.

If it does not help

  • A single page 404s, the rest work. That is not a permalinks problem — check the page exists and is published.
  • .htaccess will not save. Check the file's permissions; it should be 644. See Fix "Unable to create directory".
  • The site is in a subdirectory. RewriteBase must match — /blog/ rather than / for a site at example.com/blog.

On this page