title: mod_rewrite: remove trailing slash (only one!)
body: <p>I use mod_rewrite/.htaccess for pretty URLs.</p>
  
  <p>I'm using this condition/rule to eliminate trailing slashes (or rather: rewrite to the non-trailing-slash-URL, by a 301 redirect; I'm doing this to avoid duplicate content and because I like URLs with no trailing slashes better):  </p>
  
  <pre>RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{HTTP_HOST} !^\.localhost$ [NC]
  RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]</pre>
  
  <p>Working well so far. Only drawback:<br>
  it also forwards <em>"multiple-trailing-slash"-URLs</em> to <em>non-trailing-slash-URLs</em>.</p>
  
  <p>Example:<br>
  <code>http://example.tld/foo/bar//////</code> forwards to <code>http://example.tld/foo/bar</code><br>
  while I only want <code>http://example.tld/foo/bar/</code> to forward to <code>http://example.tld/foo/bar</code>.</p>
  
  <p>So, is it possible to only eliminate trailing slashes if it's actually <em>just one</em> trailing slash?</p>
  
  <p>Sorry if this is a somewhat annoying or weird question!</p>
  
  <p>Thanks.</p>