Home > How Password-Protect a Folder

This tutorial is no longer supported.

My tutorial was originally written in 1998. It was written because I had spent several hours of trial-and-error and Internet searching in trying to figure out how to password-protect a folder. I finally got it right, and I wanted to document it so that others wouldn't have to go through what I did.

Since then, the Apache group has provided documentation that is better than what I originally had:

It has also been my experience that Apache password-protection has a ton of problems associated with it, due to a lack of good documentation, standards and diagnostics. You can read some documentation using the links above, but everything they describe is version-dependent, config-dependent, and module-depedent. The average webmaster who connects to a shared server via FTP has no way of knowing about the high-level settings or loaded modules. The average webmaster also has a hard time knowing the full path to his root folder, due to chroot'd FTP folders. Furthermore, many web hosting companies and hardware companies have customized the Apache source as it relates to .htaccess password protection in a way that violates all documented standards (Cobalt Raq4, Hypermart come to mind). On top of all this, very few web hosting companies have any support staff with the competence or motivation to answer questions about these things.

Because of all this, any how-to manual I wrote would need to be many pages long in order to address all possibilities, or it would be incorrect for a significant percentage of users. Therefore I've deleted my tutorial and I'm linking to the Apache standard docs instead.

As a final word, you will probably have the best luck in password-protecting your folder by using a CGI script like LockedArea or a web-based control panel provided by your hosting company. If you do try raw .htaccess manipulation and you have trouble, you should talk to your web hosting company first. Because so many potential problems are platform-specific, they have the best chance of quickly pointing you in the right direction.

Please contact Fluid Dynamics with comments or questions about this material.

The original document is at http://www.xav.com/scripts/help/passwd2.html