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
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.