title: .htaccess conflicts with protected directory (.htpasswd)
body: <p>I use a .htaccess file to rewrite my urls to make them SEO friendly, this works fine.
  This file is located in the root (public_html). A website runs there too.</p>
  
  <p>Now I created a directory named 'templates' which is CHMOD to 777.
  I want it to be protected so these files cannot be accessed from outside.</p>
  
  <p>Through directadmin I protected that folder.</p>
  
  <p>Now if I use my browser to surf on the website all the urls are still SEO friedly. However when I try to surf to that protected directory (templates) it shows a 404 page that I created but shows 401.shtml as title. If I look at the url it also shows 'domain.com/401.shtml/'.</p>
  
  <p>It does not ask me for an username or password either.</p>
  
  <p>Now if I delete or simply rename the htaccess file (to .htaccess2) which is located in public_html (the one that arranges all the SEO friendly urls) the pages on the website do not work (obviously) but now if I surf to that /templates directory, it does ask me for an username and password and I am able to login and access the files.</p>
  
  <p>This is the htaccess file I use in the root:</p>
  
  <pre><code>RewriteEngine On
  
  ErrorDocument 404 /home
  RewriteBase /
  
  RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
  RewriteCond %{REQUEST_FILENAME} -d [NC]
  
  RewriteRule ^(.*?)$ $1 [L]
  
  RewriteRule ^(nl|NL|fr|FR|en|EN)/start\.html$ /$1/ [R=301]
  
  RewriteRule ^([^/]*)$ /$1/ [R=301]
  RewriteRule ^([^/]*)/$ index.php?page=$1 [L]
  
  RewriteRule ^([^/]*)/([^/]*)$ /$1/$2/ [R=301]
  RewriteRule ^([^/]*)/([^/]*)/$ /index.php?page=$1&amp;subpage=$2 [L]
  
  RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /$1/$2/$3/ [R=301]
  RewriteRule ^([^/]*)/([^/]*)/([^/]*)/$ /index.php?page=$1&amp;subpage=$2&amp;subsubpage=$3 [L]
  </code></pre>
  
  <p>EDIT:
  I've noticed that when I turn the RewriteEngine Off in the main htaccess file it does work too (except for the rewrite of course). Any idea's?</p>