Problem with page sitemap

  • All the addresses in the page sitemap have a slash (/) at the end of the URL. This is a problem because Google does not recognize the pages and does not index them. The article sitemap instead does not have the slash in the URL and the pages are idicized regularly. How can you delete slashes from the url in the sitemap?

    • This topic was modified 7 months, 2 weeks ago by  Mr.loto.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for your query.

    We are really sorry about this.

    Your sitemap_index.xml is redirecting us to your homepage. Have you disabled the Sitemaps?

    If not, please edit your first post on this ticket and include your WP logins so we can check.

    With that said, having a trailing slash in your URL should have no effect on your indexing unless adding a slash makes your page return a 404 error.

    Please do let us know if that is the case.

    Ok thanks for the reply. I have disabled the sitemap because Google gave me this message for 985 pages in the Searh Console: “Duplicate URL and sent not selected as a canon”. I provisionally inserted the sitemaps manually into the root directory.
    If you want to take a look at the problem, I leave the login data.
    Thanks.

    Hello,

    To remove the trailing slash from the URL in the sitemap I added below filter code in your theme’s functions.php file:

    
    add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ){
    	$url['loc'] = untrailingslashit( $url['loc'] );
      return $url;
    }, 10, 3 );
    

    The URL in Sitemap no longer shows the trailing slash now. Can you please confirm?

    Thank you.

    Ok, now it’s fine. Thank you! 🙂

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?filter=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The ticket ‘Problem with page sitemap’ is closed to new replies.