• Notice regarding image hosts and attachments. See here.

.htpasswd assistance please

Soldato
Joined
16 Mar 2006
Posts
4,436
Location
Wirral
Hi All,

I have been trying to password protect my website for the last week and am pulling my hair out!

I thought I saw the light at the end of th tunnel yesterday when (after advising me to use htaccess) my web hosts realised I was on a windows server and moved me to linux.

Now the htaccess seems to work in that a pop up password request appears. I type in the username and password and get a 500 Internal Server Error every time.

I have been following various guides and cannot see what I am doing wrong.

Please help.

Here is where I am to date:-

In my root directory (web/) I have my whole site files and the .htaccess.

The .htaccess is as follows:-

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /web/.htpasswd
AuthGroupFile /dev/null
require valid-user

The .htpasswd file is in the same folder which I know is bad but I want to get it to work before I move it.

The .htaccess file is as follows:-

please:DLS2vSCepIJjI (that shouldn't be a smily face!)

Which is username 'please' with a password of 'work' encrypted here - http://home.flash.net/cgi-bin/pw.pl


Now as I see it I have either got it all wrong and should stop trying to do things I have no clue about. Or I simply do not have the path to the .htpasswd file correct. Or I am messing up the encyption somehow.

Sorry for the long winded post but I am fed up and thought I would give all of the info I have.

Thanks.
 
Last edited:
Stating the obvious, but you have created a .htpasswd (at /web/.htpasswd) file with single line entries for each valid user haven't you?

Code:
test:c2xE9PUQcwI9I
 
Is /web/.htpasswd the correct path? If it's in the same directory try using:

Code:
AuthUserFile .htpasswd

I'm not sure if that will work (can't test it atm) but make sure that the path is correct. Check with your host for the actual path of your web directory - sometimes this is noted in your control panel for scripts that require the actual path.
 
Just tried that idea (thanks) but no joy there.

Would I need the full path? Is it possible there is something before /web/ that my host has there? If so how can I find out other than ring them on Monday?
 
Check with your host for the actual path of your web directory - sometimes this is noted in your control panel for scripts that require the actual path.

My thought is that /web is not in the root of the server but just your home directory and that there are probably directories above it. If you have a control panel it's probably noted in their somewhere (it is on UK2 anyway).
 
Yeah, that is my conclusion too. Thanks for your help, I will have to contact my provider on Monday to find out. Unless anyone else knows the full path to the root of a site hosted by Amen World?
 
Panser_bjorn, thanks for your help. There are a few directories before my /web. I have now had confirmation what they are from my host and have updated my .htaccess file and it now works.
 
Back
Top Bottom