以下代码有效:
AuthUserFile /etc/apache2/.htpasswd
AuthType Basic
AuthName "Please enter the username and password"
Require valid-user
以下没有:
AuthUserFile /etc/apache2/.htpasswd
AuthType Basic
AuthName "Please enter the username and password"
Require valid-user
<Directory /var/www/e>
Satisfy any
</Directory>
而不是,我的意思是它会引发服务器默认的 500 错误。
我这样做是为了尝试为 403 页面创建一个 ErrorDocument,但每当我指定一个页面时,它都会给我一个 500 错误。我最初认为这可能是因为我试图链接到的 403.html 文档受密码保护,但事实并非如此。
以下代码也会抛出 500:
AuthUserFile /etc/apache2/.htpasswd
AuthType Basic
AuthName "Please enter the username and password"
Require valid-user
ErrorDocument 403 http://google.com
相关文件读出?(我认为?)我很抱歉对此如此陌生。
root@####:~# cat /etc/apache2/sites-available/default
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride none
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride none
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
root@#####:~#
我只是想创建一个 403 文档,指向任何方向都会非常有帮助。我再次对这看起来多么简单表示歉意,我的 google-fu 还不够强大,无法找到与“创建 403 错误 htaccess 导致 500 错误”准确匹配的资源