Mobile app version of vmapp.org
Login or Join
Samaraweera270

: .htaccess password protection generates 500 internal server error I have created a .htpasswd file using htaccess tools of which I have uploaded to the root of my web hosting space (/public_html

@Samaraweera270

Posted in: #Error #Htaccess #Htpasswd #HttpCode500 #Security

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Samaraweera270

1 Comments

Sorted by latest first Latest Oldest Best

 

@Gretchen104

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).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme