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:
———-.htaccess—————————————
AuthUserFile /your/path/passwordprotected/path/.htpasswd
AuthName “Display Text”
AuthType Basic
Require valid-user
————————————————————–
- 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:
——————–.htpasswd————————————-
phpResource:$apr1$roLEO/..$ZXhi6TbX6L22wG78yhWtR/
rupom:$apr1$dcIUu…$8zByhyvWMi9oKHBReQv/n0
——————————————————————–
[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.
BEST REGARDS.





October 24, 2007 at 1:09 am |
[...] You can read the rest of this blog post by going to the original source, here [...]
November 1, 2007 at 8:24 am |
Pretty awesome article. Thanks! – CowDir