how to fix wordpress error 404 page not found

How To Fix WordPress 404 Not Found Error

how to fix wordpress error 404 page not found

WordPress 404 not found error indicates that your server is unable to find the posts or pages in your site. This error can occur unexpectedly, or in some cases, after you make changes to your WordPress site.

Fixing this error is usually an easy process. In this guide, we will take you through the steps to solve posts returning 404 error in WordPress.

We love WordPress as it is a very powerful, yet very flexible CMS. And we are not the only one, as it powers more than 30% of the Internet. But, that flexibility can be a double-edged sword. Sometimes, you just do too much, overtaking some settings and the whole hell breaks loose, random errors start appearing, and your site goes down. Thankfully, because WordPress has so many users, finding help is not that hard.

We have done a series of articles covering the most common WordPress errors, explaining to you how to fix them. For example, we have done an article on How to fix briefly unavailable for scheduled maintenance, or Maximum Execution Time Exceeded errors. You can also check our WordPress support forums to learn how to ask for WP Help.
Of course, if you are unable to fix issues yourself, you can always contact FixRunner, and get your site back to full speed ASAP.

 

Content

How to Fix WordPress Posts Returning 404 Error

  1. Save Permalinks
  2. Manually reset permalinks:

 

How to Fix WordPress Posts Returning 404 Error

Since this error indicates a problem with your links, you can usually fix it by ensuring your permalinks are correctly configured and saved. You may also need to reset your linking structure using your .htaccess file.

1. Save Permalinks

Very often, the solution to 404 error in WordPress is simply saving your permalinks. Doing this will update your .htaccess file with the correct configurations for your WordPress website.

To save permalinks, login to your WordPress dashboard and go to Settings > Permalinks.

Permalink Settings in WordPress

Next, scroll to the bottom and simply click Save Changes.

Save Permalinks in WordPress

Now try accessing your posts to see if the issue is resolved.

2. Manually Reset Permalinks

If saving the permalinks did not solve your issue, you can manually reset it by editing your .htaccess file.

To do this, access your website files using FTP. When connected via FTP, locate your .htaccess file and edit it.

edit htaccess

Add in one of the following codes, save, and upload the updated file to your server:

 

A) When your site is in the main domain

If your site is on the main domain, e.g. www.yoursite.com, add this code to your .htaccess file:


# 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]
</IfModule>
# END WordPress

After editing and uploading the file, refresh your site and access posts and pages to see if this fixes your issue.

B) If your site is in a subdomain

If your site is installed in a subdomain, such as blog.yoursite.com, use this code instead.


RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

C) When your site is in a subdirectory

If your site is on a subdirectory, such as www.yoursite.com/blog, edit .htaccess to include this code instead.


RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

How Can You Use This Information?

Fixing 404 error usually involves ensuring your WordPress permalink structure is correctly configured in your .htaccess file.

The steps covered in this guide have shown you how to do this from within the WP dashboard, as well as by manually editing .htaccess. In some cases, the solution may be more complex. For example, you may need to enable mod_rewrite if it is disabled. If you have gone through the steps and still have this issue, please tell us about it in the comments. We will help however we can and provide a quick fix.

Alternatively, you can request our WP Support service and one of our developers will get to work immediately to fix your site and WordPress Error 404.
For more step by step WordPress tutorials check our WordPress blog.