title: Protect folder with password fails on localhost (under Apache and Windows)
body: <p>I am trying to protect a folder from direct access with username and password on localhost under Apache webserver on Windows machine. According to this <a href="http://davidwalsh.name/password-protect-directory-using-htaccess" rel="nofollow">article</a>, I've looked for <code>DOCUMENT_ROOT</code> value in phpinfo results and found the following: <code>C:/Program Files/Apache Software Foundation/Apache2.2/htdocs</code>. </p>
  
  <p>Since my folder inside <code>htdocs</code> is called <code>protected</code>, I created the following htaccess file:</p>
  
  <pre><code>AuthType Basic
  AuthName "restricted area"
  AuthUserFile C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/protected/.htpasswd
  require valid-user
  </code></pre>
  
  <p>and the following .htpasswd (user:test, password: test)</p>
  
  <pre><code>test:teH0wLIpW0gyQ
  </code></pre>
  
  <p>But when I try to access the folder, I receive an "Internal Server Error". Looking on Apache error log, I found the following line:</p>
  
  <pre><code>[Thu Mar 13 22:00:15 2014] [alert] [client 127.0.0.1] C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/protected/.htaccess: AuthUserFile takes 1-2 arguments, text file containing user IDs and passwords
  </code></pre>
  
  <p>What am I missing? I doesn't seem to be related to spaces in .htpasswd path, but something related to .htpasswd sintax. I would like to build something which can be used both on localhost and online.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Enclosing htpasswd path into inverted commas eliminates the error</p>
  
  <pre><code>AuthUserFile "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/protected/.htpasswd"
  </code></pre>
  
  <p>but unfortunately doesn't work (if I type user:test, password:test when required I receive a password mismatch error). See the following apache log:</p>
  
  <pre><code>[Thu Mar 13 22:26:43 2014] [error] [client 127.0.0.1] user test: authentication failure for "/protected/": Password Mismatch
  </code></pre>
  
  <p>Any ideas?</p>