Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

Your Answer


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.