Register Login

Change 404 Page to 410 page in Wordpress

Updated Jul 11, 2019

Hi

In my wordpress I want to give 410 Return Code insted of 404 page

1. Install Plugin "404page – your smart custom 404 error page"
https://wordpress.org/plugins/404page/

2. Edit your 404.php

Manuel Edit 404.php file in your template folder 

"/wp-content/themes/themename/404.php"

Edit 404.php file on you current running theam and add this code on the top of the page and save the file

header("HTTP/1.0 410 Gone");

Example

<?php 
header("HTTP/1.0 410 Gone");
get_header();
$page_content = ot_get_option('page404_content','Page not found');
$layout = 'full';
?>

 

To check if the page is returning 410 as return code check your site url in " https://redbot.org/ ".

http://www.mysite.com/sssss.html

If I check this url in " https://redbot.org/ " it will show return code as 410. 

The return code will be 

HTTP/1.1 410 Gone

Redbot.org check return code

Regard's

 


Comments

  • 14 Sep 2017 12:39 am Guest

    admin kindly clear this. at which place we should palce code header("HTTP/1.0 410 Gone"); in 404.php ?


×