Trying to use .htaccess and .htpasswd


While I do testing I want to password protect my whole site.

my first question is the ultimate newbie question: “what is my username?” All the instructions for pathnames say “/home/USERNAME” or some such, but the only username I have been given is my ftp and email usernames. Is this the same thing?

Anyway, assuming answer to above is yes…

I have created an .htaccess file that looks like this:

AuthName "This site is currently password protected"
AuthType Basic
AuthUserFile /home/MYSTERIOUSUSERNAMEHERE/.htpasswd
Require valid-user

I put this file at the top of my directory that is named the same name as my domain.

Then, in my root directory (I am using the net2ftp user interface. also at the this level is maildir and logs)
I created an .htpasswd file that looks like this:


… but the site won’t let me in. Why?

Also, do I have to put a new .htaccess file in each directory I want to protect, or does the one at the top level apply to all it’s children?

One more: I don’t want to allow directory listings of subdirectories within my domain. How do I do that?



Sounds like you skipped the password encryption step.

Did you try using the panel to set it up?

[color=#00CC00]ANONYMOUS0 => Max Discount[/color], [color=#6600CC]ANONYMOUS2 => Max Discount less $1[/color] or Cut the code, [color=#CC0000]it’s their birthday:[/color] [color=#00CC00]9999 => $99.99 Off[/color]


The FTP username given to you when you signed-up is the default machine user created for you by DreamHost. If this is your only user (you can create others), then this will be the username you use for file paths etc.

[quote]I created an .htpasswd file that looks like this:
Are you using encrypted passwords in your .htpasswd file? You can use the tool linked below to generate your .htpasswd file.

Add the following line to your .htaccess file.

Options -Indexes


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


works like a charm. thanks very much.