问题
My first time using htaccess to ask for a user password. on my server
.htpasswd file lies in my root directory of my server.
.htaccess file lies in folder folder "uploads" (which lies in the root dir)
i used …
<?php
echo dirname(__FILE__);
?>
to get the full server path to my root dir.
my .htaccess file in my "uploads" folder looks like this now:
AuthType Basic
AuthName "Uploads to my website"
AuthUserFile /home/.sites/74/site484/web .htpasswd
Require valid-user
and my .htpasswd file in the root looks like this:
admin:$apr4$CxS3O/..$vJcWNd6tlUwg6PAn.6cpA1
now when i browser to mydomain.com/uploads i get:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
what am i doing wrong here?
thank you for your help!!!
回答1:
Looks like there's a space instead of a slash between the directory and file name in the AuthUserFile line.
来源:https://stackoverflow.com/questions/3655771/htaccess-and-htpasswd