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.
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.