htaccess and htpasswd?

家住魔仙堡 提交于 2019-12-08 06:37:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!