mod_rewrite: remove trailing slash (only one!)
the following rule will match any URL ending in a slash and remove all slashes from the end of it:
RewriteRule ^(.*)/+$ $1 [R=301,L]
Note: The currently accepted answer only works for http not https but this one works for both.
change the rewrite rule to:
RewriteRule ^(.+[^/])/$ http://%{HTTP_HOST}/$1 [R=301,L]
in English: match the start of the string, one or more anything, NOT a slash, a slash, the end.
^(.+[^/])/$
I.e. the forelast character must not be a slash.