Force trailing slash (redirect if no trailing slash exists) in .htaccess
October 26, 2018
If you want to redirect from http://example.com/test to http://example.com/test/ then you can use the following .htaccess code:
RewriteCond %{REQUEST_URI} \/+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
Don't forget that you will probably need to enable the rewrite engine for these rules to work. Click the button below to find out how to do this.