How to change all 404 to 410 error code in WordPress

If you want to change all 404 error of your WordPress website into 410 error statues then just add this code before the get_header(); in you 404.php template

1
2
3
4
5
<?php
// Set 410 - GONE status for all 404 pages
header($_SERVER["SERVER_PROTOCOL"] . " 410 Gone");
get_header();
?>

Hope it helps.



default code


<?php get_header(); ?>


<div id="main-content">

<div class="container">

<div id="content-area" class="clearfix">

<div id="left-area">

<article id="post-0" <?php post_class( 'et_pb_post not_found' ); ?>>

<?php get_template_part( 'includes/no-results', '404' ); ?>

</article>

</div>


<?php get_sidebar(); ?>

</div>

</div>

</div>


<?php


get_footer();


Comments

Popular posts from this blog

cpanel exam CPSP Answers

How to install zimbra collaboration suite 8.8.11 on CentOS 7

awstats installation