I found somewhere a tip to put some code in the head.php file of your template (sorry can't find it at the mo, but I'm sure some Googling will discover it for you).
I ended up putting this in my head.php (which I found here: templates/[MY TEMPLATE NAME]/blocks/head.php) BTW I didn't want the trailing slash in my URL - you'd need to tweak this if you do want it.
But you could probably get away with something simpler, there's some discussion about it here: http://www.brucerick.com/joomlas-sh404sef-and-canonical-links/
Oh and feel free to improve my php/regex...I'm no expert