• Blog
  • How to Fix WordPress Posts 404 Error in 2022

How to Fix WordPress Posts 404 Error in 2022

If you’ve ever gotten a 404 on your inner WordPress pages, you know how frustrating this issue can be. If you’ve recently moved web hosts, or migrated your database, this issue can be somewhat common.

But don’t fret! Most often this is caused from your WordPress permalinks not working. Luckily there is a very simple fix that remedies most WordPress 404 scenarios like this.

Save Permalink Settings to Fix WordPress 404 Errors

WordPress permalinks not working? Try this simple fix for your WordPress 404 errors.

If your WordPress posts are returning 404 error, follow these quick steps to correct the issue:

  1. Sign into your WordPress Admin
  2. Go to Settings > Permalinks
  3. Ensure your settings are correctly set – oftentimes to Post Name which displays as /%postname%/
  4. Click the Save Changes button
  5. If you have a caching plugin enabled for your website, flush (or delete/purge) the cache

By entering the WordPress permalink settings and re-saving this will force an update of your permalink structure, flush the rules cache, and rewrite the rules to your database. In most WordPress 404 cases this simple trick of re-saving your permalink settings fixes the issue!

Restoring .htaccess

In the unlikely evet that this Save Changes process doesn’t fix your 404 errors, you may need to edit your .htaccess file manually. By default, the WordPress .htaccess file handles how your website’s permalinks are displayed – ie: example.com/2018/08/sample-post/ or example.com/sample-post. Sometimes your WordPress .htaccess file can become corrupt, or permissions changed, most often due to a misbehaving plugin.

  • First, locate your .htaccess file via an FTP tool like Filezilla. The file will be in your root directory, which is where the main WordPress folders are located such as /wp-content/ and /wp-includes/
  • Second, change the permissions of the file from 660 to 666. Then go back to your WordPress Admin dashboard and repeat the permalink Save Changes process as outlined above.
  • Finally, re-check your website.

If this process works, then reset your .htaccess file permissions back to 660. If this process still did not work, then try restoring your .htaccess file.

To restore your .htaccess file, overwrite your existing .htaccess code with the following code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Once your file is restored, then proceed with the 660 > 666 permissions change and repeat the Permalink settings Save Changes process. Again, do not forget to change your permissions back to 660 after this process is completed, or you will leave a security vulnerability open in your website’s database.


I still have WordPress Posts with 404 Errors

If for some reason this process hasn’t fixed your 404 issues, you may need to create a backup of your WordPress website, re-install WordPress, and restore your backup to a fresh install.

Related Posts: