"/" at the end of url in sitemap

  • I have some problems in my product sitemap. In my websitesite, on the product pages all url aren’t contain “/” at the end of url. For examples site.com.ua/tov/riukzak/muzhskie-riukzaki/riukzak-kozhanyi-tiding-bag-m8801a-5542/
    but, in sitemap, all of url’s had “/” at the end of url http://prntscr.com/n3pim2
    How I can fix this problem in sitemap?

Viewing 15 replies - 1 through 15 (of 27 total)
  • Hello,

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

    You can remove the trailing slash on your URLs by adding the following snippet 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 );

    Let me know how this goes.

    Thank you.


    this fix will be work only in sitemap for product?


    Thank you for contacting Rank Math today.

    This snippet should be able to work across all your post types not just products!

    I hope this info helps. Thank you.


    I mean it’s able to sitemap only, or my site?


    Thank you for the question.

    This filter will only modify the entries on your site map and not the saved URLs on your site database.

    I hope this helps. Thank you.


    thanks a lot


    We are super happy that this info helped. 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.

    sorry, but it’s doesn’t helped me http://prntscr.com/n471ro
    its my function.php http://prntscr.com/n472ff


    Looks like a cache issue to me. Please clear your browser’s cache, update the permalinks and Sitemap Settings and see if it helps.

    Thank you.

    i cleared browser’s cache and sitemap settings – doesn’t helped


    I am so sorry about that.

    Could you please add your WP logins to the sensitive data section so we can take a closer look? This looks weird indeed.

    done, please check


    Thank you for the response.

    I am sorry but it does not look like the data that you added got to my end. Kindly edit the sensitive data section once more and ensure that you save the changes.

    Looking forward to helping you. Thank you.


    i added my sensetive data and saved. but, after reload page, this information doesn’t saved.

    Hi there,

    Thanks for the response.

    This is odd! Could you please login from a different browser and try to add the sensitive data once more?

    I’m looking forward to your response.


    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 15 replies - 1 through 15 (of 27 total)

The ticket ‘"/" at the end of url in sitemap’ is closed to new replies.