Need to add trailing slash to all internal links relative and absolute

i need to rewrite the url path of my href internal links. I got into my site relative and absolute links.

ex.

<a href=”https://www.sitename.com/pippo”
<a href=”/pippo”
<a href=”/pippo/”

I need a php function to insert inside child theme that check if an href is internal links and check the last char of url path and then if there isn’t as last char the ‘/’ apply it to internal links.

Only inside the posts and pages.

This to avoid the huge 301 redirection quantity.

Thanks for your support.

Read more here:: Need to add trailing slash to all internal links relative and absolute

Leave a Reply

Your email address will not be published. Required fields are marked *