Best place to solve it is in your apache configuration.
- Duplicate sites: choose one and permanently redirect the rest. For me, all www.reinout.vanrees.org traffic is redirected to reinout.vanrees.org.
- Trailing slashes: redirect URLs ending in / to their non-slash equivalents.
For (1), use this as an example:
<VirtualHost *>
ServerName www.reinout.vanrees.org
Redirect permanent / http://reinout.vanrees.org/
</VirtualHost>
For (2): you probably have big "virtualhostmonster" rewriterule at the end of your apache config. Copy/paste that line and use ^(.*)/$
instead of ^(.*)
in the first one. That effectively strips trailing slashes.