Move All 404 To 410

Move All 404 To 410

move 404 URL to 410 in WordPress

It’s a good idea to use HTTP “410 Gone” status over “404 Not Found” because bot treats 404 and 410 differently if you have lots of 404 page then bot try to crawl the page for a longer period of time where 410 is treated as permanently removed so bot does not crawl that again. This post from 2009 by John Mu on Google’s Webmaster Central forums says:

“I followed up on the 404 vs 410 thing with the team here. As mentioned by some others here & elsewhere, we have generally been treating them the same in the past.

However, after looking at how webmasters use them in practice we are now treating the 410 HTTP result code as a bit “more permanent” than a 404. So if you’re absolutely sure that a page no longer exists and will never exist again, using a 410 would likely be a good thing.”

So now the question is how to do this in WordPress?
It can be achieved by going through the following steps

Create a custom page for 410

First, you have to create a custom ‘Error 410’ page from WordPress admin panel (Dashboard > Pages > Add New) and then give an appropriate title and write the content that you want to display. After writing the content Publish it and note the page ID.

How to implement 410 in WordPress

Add below code in your active theme 404.php file.

Open your active theme 404.php file in notepad or in any other text editor and add the below 4 PHP line at the starting of the file.

$custom_410_page_ID = 329;//Error 410 page ID
header($_SERVER["SERVER_PROTOCOL"] . " 410 Gone");
header("Refresh: 0; url=" . get_permalink($custom_410_page_ID));
exit();

All done, cheers 🙂 Now when you will see your webmaster report it will show a decrease in an amount of 404 Pages.
Let me know in the comment if you face any difficulty while implementing it or have any suggestion for us then we will love to hear from you.

Share this Post:

About Raunak Gupta

I'm an expert Laravel, WooCommerce, WordPress theme and plugin developer, over the time I have developed several sites and applications. I like to help the upcoming developer, So I share my experience through this blog.  

Related Posts:

4 thoughts on “Move All 404 To 410

  1. jferraz@funidelia.com'

    WOW, great, and in Firefox it works like a charm, but unfortunately, it is not working in Chrome! 🙁

    I have been searching and seems to be a well know issue, but I cannot solve it.. 🙁

    Any idea? Thanks a lot, regards,

    Reply
    • Is it? I tried to replicate the issue but I tested in major browsers and it worked like a charm.
      Have you tried in chrome incognito mode?

      Reply
  2. raymondmercer@aol.com'

    Ӏ like this idea.

    Thanks for the post.

    Reply
  3. david@wp-killer.co.il'

    Indeed works with FF but not with Opera or Chrome where the browser shows its internal 410 error page instead of the WP one.

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *


*