
Adding a trailing slash to requested urls using .htaccess
The snippet below can be used in an .htaccess file to redirect any requests to an identical url, but with a slash at the end of it.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ localhost/$1/ [L,R=301]