Skip to content
WordPress3 min read

How to fix WordPress posts and pages returning 404

404 Not Found

Short answer

When the WordPress homepage works but posts and pages return 404, the rewrite rules in .htaccess are usually missing or broken, which is common after a migration. Quick fix: go to Settings » Permalinks and click Save Changes; if that doesn't work, put the default WordPress rules back into .htaccess.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Common causes
  2. How to fix it
  3. Prevention
  4. On ArabyHost

WordPress has no real file for each post. URLs like example.com/my-post/ depend on rewrite rules in .htaccess that send every request to index.php, where WordPress looks the post up in the database. Without those rules the server looks for a folder called my-post, doesn’t find one, and returns a 404 error before WordPress is even involved. That’s why the homepage (which is index.php itself) works while everything else fails.

Common causes

  • .htaccess missing after a migration: dotfiles are hidden and sometimes don’t get copied.
  • .htaccess overwritten by a plugin or manual edit that removed the WordPress block.
  • The permalink structure changed without redirecting old URLs.
  • A new plugin registered content types (such as store products) before the rules were refreshed.
  • A subdirectory install with the wrong RewriteBase.
  • .htaccess permissions prevent it from being read.
  • A slug clash between a page and a category.

How to fix it

1. Run a quick test

In Settings » Permalinks, temporarily choose Plain and save. If a post opens via a URL like ?p=123, the rewrite rules are the problem, not the content. Then switch back to the structure you were using.

On the same screen, click Save Changes without changing anything. This refreshes WordPress’s rules and tries to rewrite .htaccess. Test a post afterwards in a private window.

3. Restore the default rules by hand

If it still fails, open Files » File Manager in cPanel, click Settings and enable Show Hidden Files (dotfiles), then open or create public_html/.htaccess and add:

# BEGIN WordPress
<IfModule mod_rewrite.c>
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]
</IfModule>
# END WordPress

If WordPress lives in a subfolder such as /blog, use RewriteBase /blog/ and make the last line RewriteRule . /blog/index.php [L]. Leave any # BEGIN LSCACHE block in place; it belongs to LiteSpeed Cache.

4. Check the file’s permissions

In File Manager, right-click .htaccess, choose Change Permissions and set 644. The chmod calculator can help you work out values.

5. Rule out plugins and caching

If the problem began after installing a redirect or security plugin, disable it and test. Then purge LiteSpeed Cache or Cloudflare so cached 404 pages aren’t served.

6. Check the post itself

Make sure the post is published, not a draft or in the trash, and that no page or category uses the same slug.

Prevention

On ArabyHost

Sites run on LiteSpeed, which reads Apache-style .htaccess rules, so the default WordPress rules work as they are. File Manager is in cPanel, opened with one click from the Araby Panel, and daily backups (JetBackup) let you restore a previous .htaccess if you delete it by mistake. If you’re moving your site from another host, take advantage of our free migration help.

FAQ

Will 404 errors hurt my posts' Google rankings?

If you fix it quickly, rankings usually aren't affected, since Google re-crawls the URLs. If it lasts for days, some pages may temporarily drop out of results, so fix it as soon as you notice.

I changed the permalink structure and old links now 404. What should I do?

Links already published on Google and other sites no longer match the new structure. Switch back to the old structure, or add 301 redirects from the old URLs to the new ones.

Why doesn't WordPress write .htaccess automatically?

It doesn't have permission to write the file, or a security plugin blocks it. WordPress then shows the rules on the Permalinks page so you can paste them in by hand.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.