2

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 and accessed the folder via the URL in my browser it returns a 500 internal server error. I have used this same method before successfully.

Am I referencing the .htpasswd file 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?

1 Answer 1

5

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 into my webspace 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).

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.