Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress change all 404 to 410 error code

My wordpress site has nearly 3000 posts that was deleted recently. Instead of showing error code 404, How do I show error code 410 to all deleted or not found posts and pages?

like image 632
twrld1 Avatar asked Oct 22 '25 15:10

twrld1


1 Answers

you don't need to create a page. just add this code before the get_header(); in you 404.php template

header($_SERVER["SERVER_PROTOCOL"] . " 410 Gone");

Hope this helps!

like image 155
Pedro Vasconcelos Avatar answered Oct 25 '25 11:10

Pedro Vasconcelos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!