Password-protecting Web Folders I

Password protecting your web folders / directories is easy - if you know how. When I first wanted to password protect some of my web folders, I understood so little and it didn't help that so many tutorials out there showed me different ways to do effectively, the same thing.

Well, the method I use now is very straight-forward and I think will eliminate the need to chmod files and such (which I can't stand to do). Also, you need to be certain that your web server is the Apache Web Server.

Let's assume a few things first:

Your WWW root is:
path: /home/username/public_html/
and your password protected folder is going to be:
path: /home/username/public_html/articles/secret/

So basically when a reader types you want it to prompt for a username and password.

.HTPASSWD folder

Create a .htpasswd folder outside your web root:
path: /home/username/.htpasswd/

Now create the 2 folders that match the structure of your password protected folder of your web:
path: /home/username/.htpasswd/articles/secret/

Inside this folder create a passwd file. Yes, that's right, just name it passwd - no extensions!

path: /home/username/.htpasswd/articles/secret/passwd


This file will contain your username(s) and encrypted password(s) and will usually look like this:


To create your passwd file, use the following .htpasswd generator to generate a username / encrypted password pair for yourself

Fill-in the form below.


Now, the second part of this article describes the other file we need to create to complete our password-protected web folder - .htaccess. Go to...

Part II


Do you like the new design?



 Don't know