Wow... after a few painful hours, I can share with you a little more about using .htaccess in Windows as opposed to Linux. There are some things that the book doesn't tell you, but the
site linked to above does— still there is just a little info left out that I think should be mentioned explicitly.
For one, like the site says, you'll want to use an absolute path to the file which will house the usernames and passwords. You can name this file whatever you like. Use the htpasswd.exe program in the bin folder of your Apache installation to create the password file:
Code:
C:/Program Files (x86)/Apache Software Foundation/Apache 2.2/bin>htpasswd -c userauth john
Now, if you create the password file like this, you'll want to run CMD with Administrative privileges. Otherwise, it may not actually create the file. This happens with 64-bit Vista or 7 if you install this program in the Program Files (x86) folder. If you install Apache into another directory, you should be able to avoid this issue. Otherwise, you can just create the file elsewhere. To do so, simply specify the password file's path and fileaname in the command:
Code:
C:/Program Files (x86)/Apache Software Foundation/Apache 2.2/bin>htpasswd -c E:/Any/Other/Location/logins.txt john
It is advised that you place the htpasswd files somewhere above or outside of Apache's DocumentRoot directory. And, of course, you can avoid going to the bin folder every time to run the commands by putting the folder's absolute path in your Windows PATH environment variable.