sitemap.xml non existing page url

#259675
  • Resolved Demo Zap
    Rank Math free

    Hi Team,

    I need a support. I have added few redirections using the rankmath as below
    https://xyz/asphalt-shingle-roofing redirects to https://xyz/myrtle-beach-sc-roof-replacement/

    I do not have any page “asphalt-shingle-roofing” in my site and I added a redirection only to other page for this but now I see the sitemap.xml is having the url https://xyz/asphalt-shingle-roofing which is now being reported as concern by google as page does not exist (& it is redirection).

    As it is a non existing page so I am not sure how to add a “noindex” so that it can be excluded from sitemap.xml. In one of your tickets below code was mention to be used to add noindex but I really dobut it will work as the get_posts( array( ‘name’ => ‘asphalt-shingle-roofing’ ) ) function will return nothing as it is trying to fetch a non existing post & if $page will return false.

    Please guide how to address the concern. I do not want the redirection page to appear in the sitemap.xml

    /**
    * Allows filtering of the robots meta data.
    *
    * @param array $robots The meta robots directives.
    */
    add_filter( ‘rank_math/frontend/robots’, function( $robots ) {
    global $post;
    $page = get_posts( array( ‘name’ => ‘asphalt-shingle-roofing’ ) );
    if($page){
    $robots[‘index’] = “noindex”;
    $robots[‘follow’] = “follow”;
    return $robots;
    }
    return $robots;
    });

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.

    Could you please share the actual URL of your website so we can investigate the issue further and check why this page might be appearing there?

    While you do that, let’s also try to flush the permalinks of the sitemap by following this tutorial: https://i.rankmath.com/pipRDp
    ​​​​​​​
    Then, make sure that you exclude your sitemap from being cached by following this tutorial: https://rankmath.com/kb/exclude-sitemaps-from-caching/

    Looking forward to hearing back from you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘sitemap.xml non existing page url’ is closed to new replies.