Why are all the links without the trailing / on my website redirect to the same link with the trailing link?

Hi

I have a website where every link without the trailing slash / redirects (301) to the same link with the / added to the end. For example, a.com/foo redirects to a.com/foo/ (/ added to the end of the link(

Why is this happening? It's causing issues with my Ahrefs reports throwing so many warnings about redirects and also messing with the sitemap.

Is this an internal WP behavior?

Thanks

1 Comment
  1. Yes it’s default behavior. You only want one canonical version of every page. If this didn’t happen, you’d have two.

    The problem here is that you are likely linking to URLs without the slash, so ahrefs is following that redirect and flagging it.

    The solution is to only link to the canonical version of your page – with the slash.

    Note that you can remove the slash in permalink settings – but they you’ll probably have the same issue in ahrefs but in reverse. You need to decide on one or the other and ONLY link to that version.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer