Hello,
Thank you for contacting the support and sorry for any inconvenience that might have been caused due to that.
To fix the trailing slash you can use the following filter and paste it inside your theme’s function.php
file.
/**
* Allow changing of the canonical URL.
*
* @param string $canonical The canonical URL.
*/
add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
return trailingslashit( $canonical );
});
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hi, will it 301 redirect non trailing slash urls to trailing slash urls?
Hello,
If the page has canonical URL then the filter will simply put slash at the end of the URL inside the source code of the page. If you want to redirect the page from non-slash to slash URL, then you do with the Rank Math redirection module.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello,
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.