manage 410 errors (page gone)

Posted in: Newspaper
Post count: 38

Hi
Is there a way to create a cloud template, or a way to handle 410 pages in the same way as 404 pages, but with a different message, something like not ‘Page not found’ but ‘Page removed’ or something similar?
Thanks, Luca

Post count: 35449

Hi Luca, the Newspaper theme does not have this kind of template, but it can be achive with custom code or an extra plugin: https://www.youtube.com/watch?v=45iWiRZpuOo

Post count: 38

thanks for your reply, I already use a code in template_redirect action in funcitons.php, see below, to remove some sections and automated pages that I don’t need anymore on a specific site.ho provato ad incollare il codice ma wordfence non mi lascia inviare il messaggio. I tried pasting the code, but Wordfence won’t let me send the message. Basically, I’m using a wp_die with a 410 response, and it works, but I’d like to include a design that’s more similar to the site pages created with TD Composer, Cloud Template or modules.

Post count: 35449

HI,
Could you provide a link to your website where I cna see a 410 redirect? Maybe I will see a solution to this.
Indeed, Wordfence will block you if you try to set teh code directly here. You can use something like https://pastebin.com/ to share the code.

Post count: 38

Hi Calin, thanks again.
In fact, I managed to find a fairly simple solution: instead of using wp_die for 404 pages, I simply use this code:
status_header(410);
nocache_headers();
get_header();
echo “page has gone”;
get_footer();
exit;
This is enough to ensure the page matches the site’s design.
Thanks again and best regards, Luca

Post count: 35449

Hi,
I’m glad that you managed to find a better solution and now match the website design.

Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.