Are your WordPress posts returning a 404 error on your website?

This error occurs when you can get into your WordPress blog and admin area, but when you attempt to open a post, "404 Not Found" appears.

In this article, we will show you how to fix the WordPress posts returning 404 error.

What Causes the WordPress Posts Returning 404 Error?

Although WordPress is a strong content management system (CMS), a little adjustment sometimes renders your WordPress website unavailable.

In some cases, such as with an internal server issue or trouble establishing a database connection, you may be unable to access your WordPress admin area or the website itself.

In contrast, you can still access your admin area and see your WordPress website on the front end while your WordPress posts return 404 errors. After that, a "404 Not Found" warning will appear when you click on a blog post.

Even though this error notice may worry you, your WordPress articles have not been lost. Instead, it's likely that your .htaccess file was destroyed, or there was a problem with your blog's rewrite rules.

Fix Your Permalink Settings

Rewrite rule issues in your .htaccess file might result in 404 errors for WordPress posts. Most of the time, changing your permalink settings will solve the issue.

Click the 'Save Changes' button under Settings » Permalinks in your WordPress admin.

update permalink setting

This will flush the rewrite rules and update your permalink settings.

This technique often fixes the WordPress posts 404 error. You will likely need to manually change your .htaccess file if it does not work.

Update the WordPress .htaccess File

You must first use an FTP client or the File Manager application in your WordPress hosting dashboard to establish a connection to your server.

The .htaccess file must then be identified and edited in the same directory as directories like /wp-content/ and /wp-includes/.

Right-click on the file and select ‘File permissions’.

.htaccess file permissions

By setting the file's permissions to 666, you may enable writing to it. Type 666 into the "Numeric value" box and click "OK."

Database name and username

Remember to set the permissions back to 660 when you've finished. The file may also be edited and code added to it.

edit .htaccess file

Once you have opened the .htaccess file with a text editor, simply insert this code.

# BEGIN WordPress

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

# END WordPress

Contact Your Hosting Provider

We advise contacting your WordPress hosting provider if none of the described above fixed the WordPress posts returning 404 error. They could have made an error, or they might be able to assist you in troubleshooting the issue.

Fix for Local Servers

You must activate the rewrite_module in your MAMP, WAMP, or XXAMP site's Apache setup if you're using a local server for testing.

× How can we help you?