1

TL;DR : ISPConfig 的自定义错误页面是这些重定向的原因。

我们在 ISPConfig 环境中安装了 Apache 2.4。

每个虚拟主机都有一个用于管理目的的目录。我的 .htaccess 如下所示:

AuthType Basic
AuthName "Administration"
Require valid-user
AuthUserFile /etc/apache2/.htpasswd

现在,当我点击该文件夹时,http://mysite.tld/admin我会在没有登录提示的情况下重定向到网站根目录。但是,当我将 .htaccess 复制到根目录时,我得到了登录提示。

当我点击时,日志文件包含以下几行/admin

[Wed Feb 12 12:00:23 2020] [authz_core:debug] mod_authz_core.c(809): AH01626: authorization result of Require valid-user : denied (no authenticated user yet)
[Wed Feb 12 12:00:23 2020] [authz_core:debug] mod_authz_core.c(809): AH01626: authorization result of <RequireAny>: denied (no authenticated user yet)

然后我直接重定向到/.

那么重定向的原因可能是什么?

先感谢您!

! cross-post from serverfault because of its urgency !

4

1 回答 1

1

根据Dusan Bajic的评论:

在 Apache vhost 文件(由 ISPConfig 生成)中有自定义错误页面。在 vhost 文件中评论/删除这些行:

Alias /error/ "/var/www/mysite.tld/web/error/"
ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 405 /error/405.html
ErrorDocument 500 /error/500.html
ErrorDocument 502 /error/502.html
ErrorDocument 503 /error/503.html

解决问题。

于 2020-04-02T09:48:27.523 回答