Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a folder that I want to host files privately on my webserver.

How do I go about making it password protected using .htaccess?

Note: Nothing monolithic, I want something that is simple/easy so setup so me and a few colleagues can download a few files.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

You'll need to create a file called .htpasswd with the content of username:password (you should encrypt that.

Then append this to the htaccesss file:

AuthUserFile /usr/local/you/safedir/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic

require user username

Follow this guide.

Also, here is a tool for generating the encrypted passwords: http://tools.dynamicdrive.com/password (Thanks to the original poster for the link)

share|improve this answer
    
Thanks. Could you add this link in your answer too? tools.dynamicdrive.com/password. It's the password encryption tool from DynamicDrive. –  Evan Plaice Jul 8 '10 at 23:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.