If you have Yoast Plugin and your canonical link is like :

https://w3site.ca”>

it means $url variable, has trimmed and the slash has removed from end of that, so you can fix it just for canonical url by adding following code to file functions.php in your theme :

Copy to Clipboard