Because of some consecutive requests on “how to create password protected web directory”, I am putting a short guideline so I can refer them to this page in future:
- Make an htaccess file (in your desired directory) like this:
AuthName “Display Text”
- Make the .htpasswd file in the specified directory.
3. Add username and password (to enter this web directory)
You can add and update user and password by using:
>htpasswd –bm /your/path/passwordprotected/path/.htpasswd username password
b: Batch mode which facilitates you to enter user and password in the command prompt.
m: Use MD5 encryption for passwords. You can use “d” for crypt() generated passwords, “s” for SHA1 passwords, “p” for plain text passwords.
Once these steps are done, the .htpasswd looks like:
[I have created user “rupom” with password “rupom” and user “phpResource” with password “phpResource”].
Now, go to the URL where this is done, you will find what you expected.
Done! Enjoy !!
See http://httpd.apache.org/docs/1.3/programs/htpasswd.html for manual of htpasswd.