Canonical - Strips Trailing Slashes - Apache

Configure Apache to remove trailing slashes from URLs.

Code

RewriteCond %{REQUEST_FILENAME} !-d
# Externally redirect to remove trailing slash
RewriteRule ^(.+)/$ /$1 [R=301,L]