Skip to main content

How to Fix Soft 404 Errors on WordPress

By June 9th, 2020SEO, Web Design

Soft 404 errors can be quite common on WordPress websites and it is something that needs to be addressed to not confuse the search engines and help your overall site health and rankings.

In this tutorial, we will teach you how to fix Soft 404 errors on WordPress, this should also work on non-WordPress websites, depending on the type of website and setup you have.

Before we start, let’s learn what Soft 404 errors are and how different they are from Hard 404s.


What is the difference between Hard 404 and Soft 404?

Hard 404

When a visitor clicks on a link on your website that does not exist anymore, your website usually reacts by displaying a custom “404 page not found” error, and returning a 404 HTTP response to show the content is no longer there.

Hard 404 error

This is Hard 404 and it is normal.

It basically tells the content no longer exists or has been moved. The search engines have no issue with this.

Watch this quick Google video on how to properly deal with Hard 404s and follow the advice/solution John Mueller gives.

You can also read our guide on HTTP Status Codes to learn more about 404 and other errors and how they affect your SEO.

Soft 404

A Soft 404 error happens when a page has no content but the website does not return a 404 HTTP response for the page.

While Soft 404 errors don’t usually interfere with the user experience greatly, they can hamper your site’s search rankings.

Pro Tip: If you have published new content on a different section of your website and it is still relevant to the old page that has been removed, it is always a good idea to 301 redirect the old page to the new one to not lose link juice.

Understanding Soft 404 Errors

The most common cause of a Soft 404 error is when a user is searching for a query on a site’s internal search engine, that does not exist.

Let’s say that you have a blog and it is about Graphic Design. So, for example, if I go to your page and I search for something that doesn’t exist on your page, it will return an error “No match” or “Not found”.

If the server response code is 200OK, this means you have a Soft 404 error.

Soft 404 Error

You will know this because the server response code should say, 404 Not Found when something does not exist on your site.

The other possible reason is that you have a category or tag that doesn’t have any content under the category.

So, when someone clicks on your link, there is nowhere for them to be lead to.

This will also lead to the Soft 404 error if the server response code is 200 OK.

How do I check my site for Soft 404 errors?

Google Search Console is the best place to find these errors. Login to your Search Console and go to Coverage reports.

The Coverage report shows all the issues with your site including Soft 404.

Google Search Console Soft 404 error

If you click on the Soft 404 error link, it will give you more details and list all the errors as you can see in the screenshot below.

Google Search Console Soft 404 error example

If your search query error looks a little bit different then from the example shown above, it is okay. This tutorial will still work!

So, what do all these mean?

If you see all these random characters like /?s= and the /search/ this means your website’s internal search engine is returning a Soft 404 error because the content the user types on your site’s search engine does not exist.

Before we fix the Soft 404 errors let’s confirm these errors using Google Chrome Developer Tools.

Confirming the errors

To confirm these errors, copy the error code from your Search Console and past it at the end of your URL and click enter on your browser.

Soft 404 example

After this, click View on Google Chrome menu and navigate to Developers > Developer Tools.

Chrome developer tools

Then click on the Network tab on the Developer Tools and reload the page.

This will reload all the network activity on your page and list all the requests with their status codes.

Fix Soft 404 error

Notice how this URL “” says status 200 OK?

This is how the browser is tricking the search engines and it is the reason why we see the Soft 404 error in the Google Search Console.

The status should be 404 Not Found because this page does not exist. It is a non-existing search query.

Ok, now the fun part! Let’s start fixing these Soft 404 errors.

Solution 1:

Blocking search engine access to the website’s internal search functionality

This is the easiest solution and works well.

What we will do is block the search engines from accessing our website’s search results.

Note that this will not affect your website’s indexing or ranking, we will just block the internal search results.

All you have to do is to put this code in your robots.txt file and upload it to your server.

User-agent: *
Disallow: /?s=
Disallow: /search/

Please note:

  1. If you already have “User-agent: *” in your robotst.txt file, do not past this line of code.
  2. If you are using any cache plugins, make sure to clear the cache before checking.

Allow Google a few days to update this fix on Google Search Console.

Sometimes Google is slow displaying the updated information on the Search Console. If it is taking too long, follow this guide to upload your updated robots.txt file and submit to Google.

Solution 1:

Blocking search.php file to fix Soft 404 errors on WordPress

Most WordPress themes should have a search.php file, find that file and paste this code in there.

if ('{query}' == get_search_query( false )){
header( 'HTTP/1.0 404 Not Found' );
$GLOBALS['wp_query']->is_404 = TRUE;

Save and upload it to your server. Make sure you keep the backup of your original search.php file just in case something goes wrong, you have the original back up of the file.

Again, if you are using a cache plugin, remember to clear the cache after you upload the changes to the server.

Now, to check and confirm everything is working properly go back to Google Chrome and reload the page again and check your Network tab.

If the 200OK is changed to 404 Not Found the code does its job!

Fix Soft 404 error

When the search engines re-crawl your website again, they will notice the changes and your Soft 404 issue will be gone.

If you know any other methods on how to fix Soft 404 errors, we’d love to hear them in the comments!


  • Avatar of karan karan says:

    Hello, Can you tell me what is better for SEO, it is good to point all your soft 404 pages to the home page or create a relevant article for 404 pages?

    • Avatar of Amberd Amberd says:

      Are you talking about Soft 404 or Hard 404? I think you meant to say Hard 404 (or just simply 404), the Soft 404 is very different from the Hard and its explained how to troubleshoot and fix in this article.

      You can do one of the following if you meant Hard 404:

      1. You can redirect old URLs to the new ones.
      2. You can create relevant and meaningful content for those 404s that have a lot of links pointing to them. This way you will get all that lost link juice back to your site.
      3. Leave as they are if you do not intend to create content, they are perfectly fine. The search engines will not penalize you for having 404s.

      Thank you!

  • Avatar of Mohammad Mohammad says:

    Hi Amberd,

    Thanks for your helpful note on soft 404s. My problem is that Google is reporting soft 404s for about 46 pdfs that are legit. So, these are ok, existing files that tested on shows 200 for all bots. They open and are accessed just fine, but not indexed by google, so affect SEO. I have looked into all explanations and fixed some fake bot rules in Cloudflare that caused 403 codes for those links. But I can’t find any solution. It does not seem to be a matter of the contents of these pdfs, as similar pdfs are marked as valid and indexed. When I followed your Chrome developer tool, they show zero sizes, for the pdf, but when I check valid pdf URLs, they also show as zero. All pdfs seem fine, old or newly created. I have resaved them to make sure they have fast web status. Size does not seem to be an issue, the existence of broken links (or not) in them does not seem to be an issue. I hope you can have some explanation and solution for these types of soft 404 errors as well. Thanks in advance.

    • Avatar of Amberd Amberd says:

      Hi Mohammad,

      We had a similar problem with all our images, it turned out CloudFlare’s Hotlink Protection was causing this issue, you might want to turn it off if it’s on and clear your cache and in your Search Console Inspect the PDFs and request for indexation.

      This being said, Google Search Console was showing wrong information and was having a few issues lately. If you have checked with other tools and everything seems good, I’d say give Google some time, it might be an issue on their end.

      Hope this helps.
      Team Amberd

  • Avatar of Bill Bennett Bill Bennett says:

    Thanks for this fix:

    if (‘{query}’ == get_search_query( false )){
    header( ‘HTTP/1.0 404 Not Found’ );
    $GLOBALS[‘wp_query’]->is_404 = TRUE;

    I’m no coder so I struggle with the get template part because my theme has a 404 page: 404.php.

    How would that work?

  • Avatar of Frank Frank says:

    I have several reported soft 404 errors. The reason this is happening is because Google is referencing a URL based on the unique id of a row in my database. Whenever I delete a row from the database, the id disappears but Google continues to look for the original URL.
    A typical URL might be myaddress .com/this-image2.php?id=796.
    796 is the id of the deleted row in my database. How can I inform the google search that this address is a hard 404? I code in php.

    • Avatar of Amberd Amberd says:

      Hi Frank, have you tried using the Removals Tool in your Google Search Console? It takes some time for Google to clear its cache so we recommend you use the Removals tool to let Google know that page does not exist anymore.

Leave a Reply

Skip to content