How do you password protect directories with Apache?

Byte

Platinum Member
Mar 8, 2000
2,877
6
81
I've look at some tutorials, and they are all directed to unix. I'm kinda getting confused with how the directories are used. Can some one give me a sample with windows directories?
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Look for documents on .htaccess. Its about the same whether you use Windows or a server OS.
 

Need4Speed

Diamond Member
Dec 27, 1999
5,383
0
0
1. Make sure that apache is setup to use .htaccess and to allow override for user authentication
2. Create an .htpasswd file
3. Create an .htaccess file in the dir that you want to protect that looks like this

---------------------------------------------------------------
AuthUserFile /location of htpasswd file/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic

require user [username]
---------------------------------------------------------------

You will then add users to the htpasswd file using this command:

htpasswd /location of htpasswd/.htpasswd [username]

Google it...there are a ton of tutorials that will go into more detail

This is for *nix, but I'm sure that the content of the htaccess file will be the same...the procedure may vary a bit