Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have created a .htpasswd file using htaccess tools of which I have uploaded to the root of my web hosting space (/public_html is my web root).

I created a .htaccess file which referenced the .htpasswd as follows:

AuthType Basic
AuthName "Protected Area"
AuthUserFile /.htpasswd
Require valid-user

However when I uploaded this .htaccess file to the directory I want to password protect accessing the folder via the URL in my browser returns a 500 internal server error. I have used this same method before successfully.

Am I referencing the .htpasswd incorrectly? I also uploaded it to /public_html/ in case .htaccess interprets / as the web root, but the error remains.

Any ideas what is wrong?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The path after AuthUserFile is the place in the filesystem where the file lives, and you need to know where your web hosting space root really is. For example, when I FTP in to my space it looks like the root is / and the web root is /public_html, but in fact on the server the root is /home/companyname and the web root is /home/companyname/public_html. You will need to find out from your hosting company where the files really live. We have cPanel and when I go to the File Manager part I can see the real location for our files (/home/companyname).

share|improve this answer
    
I thought the path I had was odd. Thanks mate. –  Steve Apr 7 '11 at 1:06

Your Answer

 
discard

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.