Domanda

I+m trying make a folder on my server protected by .htaccess & .htpasswd. When I try to enter the folder in question I'm asked for a password like I want. But then when the page is loaded I get a 500 error, which also happens on all pages on my site now. With ErrorDocument 500 it says:

This webpage has a redirect loop

The webpage at http://example.com/test/folder/ has resulted in too many redirects. ...

This is what my .htaccess file looks like:

ErrorDocument 500 http://81.18.24.170/test/appload/
AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /test/folder/admin/.htpasswd 
require valid-user

Can anyone see a problem or something that I've missed to make it work?

EDIT: I had the rewrite rule to prevent the 301 error I get for to many redirects. (Found in another solution but it didn't help.) So I just want to get rid of the 500 error.

È stato utile?

Soluzione

When you are putting the file path for the AuthUserFile, make sure you use the FULL filepath from your root directory, for example:

AuthUserFile /var/www/html/test/folder/admin/.htpasswd

A similar issue was discussed in this thread: htaccess / htpasswd in subdir

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top