- This topic has 7 replies, 2 voices, and was last updated 3 years, 4 months ago by
David.
-
AuthorPosts
-
November 18, 2022 at 5:31 am #2421331
Growthonics
Hello, i want to clean up my site. for that i’m going to delete so many posts and i want to mark all of them as a 410 Header code not as a 404 error code.
I just created 410.php page inside the theme as directed here: https://generatepress.com/forums/topic/custom-410-error-page-2/#post-866500
But, if i visit the deleted urls it still gives 404 header response. Please help me to fix it.
Here is the 410.php page
<?php /** * The template for displaying 410 pages (Not Found). * * @package GeneratePress */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } get_header(); ?> <div <?php generate_do_attr( 'content' ); ?>> <main <?php generate_do_attr( 'main' ); ?>> <?php /** * generate_before_main_content hook. * * @since 0.1 */ do_action( 'generate_before_main_content' ); generate_do_template_part( '410' ); print "It's 410 Error"; /** * generate_after_main_content hook. * * @since 0.1 */ do_action( 'generate_after_main_content' ); ?> </main> </div> <?php /** * generate_after_primary_content_area hook. * * @since 2.0 */ do_action( 'generate_after_primary_content_area' ); generate_construct_sidebars(); get_footer();I have added example deleted post url for testing in the private information tab.
Waiting for your response,
ThanksNovember 18, 2022 at 7:09 am #2421479David
StaffCustomer SupportHi there,
The Theme doesn’t interfere with rewrite rules or redirects. Generally it will be an SEO or Redirect plugin that is responsible. If those are not in place, then check with your host to make sure there are no htaccess ( or equivalent ) rewrite rules in place.
November 19, 2022 at 1:42 am #2422582Growthonics
I do not use any rediection plugin. I use Yoast SEO plugin which is not a premium so it does not have any redirection for normal user. i also check with host support they told me that .htaccess file is fine there is no issue of it..
Also, can you please verify the 410.page and check that is it correct or not?
Please tell me how do i mark deleted posts as a 410 instead of 404?
November 19, 2022 at 4:19 am #2422696David
StaffCustomer SupportI don’t have a solution for selectively setting a deleted post to a 410.
There maybe plugins out there that do. But the Theme has no control over the header response.The simplest thing i could find on this subject is switching 404 to 410 – see here:
November 19, 2022 at 4:25 am #2422702Growthonics
Okay, just last question. how do i get the URL of 410.php page?
i tried this theinsaneapp.com/410.php but it’s showing 404 error page…
November 20, 2022 at 4:49 am #2423874David
StaffCustomer SupportIt doesn’t work like that, the header response would need to be a 410 error.
And therefore you need something that sets that header response.Apart from an SEO plugin, you could try either of these:
https://en-gb.wordpress.org/plugins/ultimate-410/
https://wordpress.org/plugins/redirection/
Topic from that plugins support regarding 410 errors:https://wordpress.org/support/topic/converting-a-404-to-a-410/This is not a theme related thing, as we don’t redirect, change permalinks or write response headers. So i am afraid thats all i can offer.
December 1, 2022 at 10:41 pm #2446105Growthonics
Thank you, David!
December 2, 2022 at 2:01 am #2446320David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.