title: Magento + htaccess + mod_rewrite: Forcing trailing slash & Force lower case URL
body: <p>I am trying to make some changes to my htaccess file for my Magento store to force a trailing slash at the end of all URL's that are not a file AND are not .html (product pages). At the same time, I am trying to force all lower case in URL's as well. Both of these are for SEO reasons, as links to /category, /Category, and /category/ are all viewed as different pages by Google.</p>
  
  <p>Here is the rewrite section of the .htaccess as it stands:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  
  Options +FollowSymLinks
  RewriteEngine on
  
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  
  RewriteRule .* index.php [L]
  
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>I was shown these two snippets, the first for forcing lower case, the second for trailing slash:</p>
  
  <pre><code>RewriteMap  lc int:tolower
  RewriteCond %{REQUEST_URI} [A-Z]
  RewriteRule (.*) ${lc:$1} [R=301,L]
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>RewriteCond %{REQUEST_URI} !(.*)/$
  RewriteRule ^(.*)$ http://domain.com/$1/ [L,R=301]
  </code></pre>
  
  <p>However I don't know exactly how or where to insert these into the existing rewrites so everything works as desired.</p>