htaccess以及htpasswd的?htaccess、htpasswd

2023-09-02 00:46:31 作者:·^-走出愛情的傷、

我第一次使用htaccess的要求输入用户密码。 我的服务器

My first time using htaccess to ask for a user password. on my server

htpasswd的文件就在于我的根​​我的服务器的目录。

.htpasswd file lies in my root directory of my server.

.htaccess文件位于文件夹中的文件夹上传(它位于在根目录)

.htaccess file lies in folder folder "uploads" (which lies in the root dir)

我用...

    <?php
    echo dirname(__FILE__);
    ?>

要获得完整的服务器路径,以我的根目录。

to get the full server path to my root dir.

在我的上传我的.htaccess文件夹看起来像现在这样:

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

和我的根htpasswd的文件看起来是这样的:

and my .htpasswd file in the root looks like this:

admin:$apr4$CxS3O/..$vJcWNd6tlUwg6PAn.6cpA1

现在,当我浏览器mydomain.com/uploads我得到:

now when i browser to mydomain.com/uploads i get:

内部服务器错误 服务器遇到一个内部错误或配置错误,无法完成您的请求。的

我在做什么错在这里?

感谢您的帮助!

推荐答案

看起来像有一个空间,而不是在的AuthUserFile行的目录和文件名之间的斜杠。

Looks like there's a space instead of a slash between the directory and file name in the AuthUserFile line.