Add slash to end of URL with htaccess

Posted by: Alex on May 4, 2014

Have you ever wanted a web page to act like a directory?
Eg, have /about, but want it to seem as though /about is a directory, such as: /about/

With the following added to your htaccess it’s simple:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*).htm
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.YOURWEBSITEHERE.com/$1/ [L,R=301]