Use the code below to force a trailing slash on your web site URLs.
When would you use this?
Search engines, most notably Google will view the two URLs below as different pages, and by doing so, will possibly get flagged for duplicate content.
https://www.domain.com/page
https://www.domain.com/page/
By forcing the trailing slash on your URL's you prevent duplicate URLs and also keeps your analytics tidier as there will only be one URL in your reports.
#####################
# Force trailing slash to avoid duplicate content
# See: https://www.jucra.com/whmcs/knowledgebase/118/
####################
RewriteEngine on
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]