WordPress

WordPress 404 Errors on Posts and Pages: How to Fix Them

Home page works but posts show Not Found? Learn how to fix WordPress 404 errors: reset permalinks, restore .htaccess, check plugins and fix 404s after a move.

By Zebra Hosting Cloud

Your home page loads, but every post or page shows Not Found. In most cases your content is still safe in the database. WordPress just can't match the web address to the right page. The usual fix takes a few minutes: re-save your permalinks, and if that fails, restore the default .htaccess file. This guide also covers plugin checks and 404s after a move. Before you change anything, take a backup of your files and database.

Real 404 or broken permalinks? Tell them apart first

A 404 is the error a server sends when it can't find the page you asked for. There are two common causes, and each has its own fix.

  • The page really is gone. Only one or two addresses fail, and you see your theme's own 404 page, with your logo and menu. Someone deleted the post or changed its address.
  • The permalinks are broken. The home page works, but every post and page fails. You often see a plain page saying The requested URL was not found on this server. That message comes from the web server, not from WordPress.

A permalink is the permanent address of a post, such as yourdomain.com/summer-menu/. For these clean addresses to work, the server must pass every request to WordPress. When that breaks, all inner pages fail at once.

A quick test: go to Settings > Permalinks, choose Plain and save. If a post now loads with an address like yourdomain.com/?p=123, your content is fine and the rewrite rules are the problem. These rules turn clean addresses into requests WordPress understands. Switch back to your usual structure right after the test.

Fix 1: re-save your permalinks

This fix works most often, and it doesn't touch your content.

  1. Log in to WordPress and open Settings > Permalinks.
  2. Check that your usual structure is selected, for example Post name.
  3. Click Save Changes without changing anything else.
  4. Open a post in a private browser window to test it.

Saving makes WordPress rebuild its address rules and, where it can, write them to .htaccess. If it can't write to the file, it shows the rules for you to add yourself.

Fix 2: restore the default WordPress .htaccess

.htaccess is a small settings file in your site's main folder. The Apache web server reads it to decide how to handle each request. If your site runs on Nginx alone, the file is ignored. Our support team can tell you which setup your plan uses.

On our WordPress and shared plans you can edit it in Plesk, the control panel. Open Websites & Domains, then File Manager, and go to the folder that holds wp-admin and wp-content. Menu names can vary between Plesk versions. Download a copy of the current .htaccess first, or create the file if it's missing. Then replace the WordPress section with the standard rules for a single site:

# 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

Keep any other rules, such as redirects or security settings, outside the # BEGIN WordPress and # END WordPress lines, because WordPress may rewrite everything between them. If WordPress lives in a subfolder such as /blog/, edit the .htaccess there. Change RewriteBase / to RewriteBase /blog/, and change the last rule to /blog/index.php. Save the file and test a post again.

Fix 3: rule out plugins, themes and custom post types

If fresh rules don't help, something inside WordPress may be changing the addresses. Common causes are security, language, shop and redirect plugins.

  • Plugins: deactivate them all, re-save permalinks and test. Then turn them back on one at a time until the 404 returns.
  • Theme: switch briefly to a default theme such as Twenty Twenty-Five. If posts then load, your theme is the cause.
  • Custom post types: products, events or portfolio items are extra content types added by a plugin or theme. After installing or updating one, re-save permalinks.
  • Clashing slugs: a slug is the last part of the address. If a page and a post share one, such as news, give one of them a new slug.

404 errors right after moving to a new host

Picture a Pristina shop that has just moved its WordPress site. The home page opens, but every product page fails. The cause is usually one of these:

CheckWhat to look for
Missing .htaccessFiles that start with a dot are hidden, and some copy tools skip them. Restore the file from Fix 2, then re-save permalinks.
Site addressIn Settings > General, the WordPress Address and Site Address should use your domain, with https://.
Old addresses in the databaseLinks may still point to a temporary or old domain. Update them with a search-and-replace tool, after a backup.
DNS still pointing to the old hostDNS, which points your domain to a server, may still lead to the old host. Test again once it has updated.

If you'd rather skip this, our free WordPress migration does the move for you on WordPress and shared plans. We test your site on a preview link first, and you switch DNS last, so visitors don't see these errors.

When the page really is gone: custom 404 pages and redirects

Say a cafe blog in Tirana changes its permalinks from dates to post names. Old links shared on social media can now lead to a 404. Re-saving won't fix this, because those addresses no longer exist.

The answer is a permanent (301) redirect, which sends visitors and search engines from the old address to the new one. Set one up for each important page that moved or was deleted.

For pages that are truly gone, make your 404 page useful. Add a search box, links to your main pages and a way to contact you. In a block theme you can edit it under Appearance > Editor > Templates. In a classic theme, it is the 404.php file.

WordPress hosting that is easier to fix, with Zebra Hosting

Most 404 errors come down to a few files and settings. On our WordPress hosting, you reach the files in the Plesk file manager, and free SSL and automatic updates are included. Stuck? Send us a ticket. Real people answer in 17 languages, including Albanian.