[eluser]Leevi Graham[/eluser]
I implemented this for ExpressionEngine and it seems to be doing the trick.
# Add Slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond $1 ^(members|contact|cms-customisation|site|ee-support|wp-content|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ $1/ [L,R=301]
Basically if its not a file, directory or one of my template groups I redirect to the exact same thing with a trailing slash.