Apache .htaccess在大多数编辑时都会抛出500错误
以下代码有效:Apache .htaccess在大多数编辑时都会抛出500错误,apache,.htaccess,password-protection,errordocument,Apache,.htaccess,Password Protection,Errordocument,以下代码有效: 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 &
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>
以下没有:
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>
相关文件读取?(我想?)我很抱歉对这件事如此陌生
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@#####:~#
root@######:~#cat/etc/apache2/sites available/default
服务器管理员webmaster@localhost
DocumentRoot/var/www
选项如下符号链接
不允许超限
选项索引跟随符号链接多视图
AllowOverride AuthConfig
命令允许,拒绝
通融
ScriptAlias/cgi-bin//usr/lib/cgi-bin/
不允许超限
选项+执行CGI-多视图+符号链接所有者匹配
命令允许,拒绝
通融
ErrorLog${APACHE_LOG_DIR}/error.LOG
#可能的值包括:调试、信息、通知、警告、错误、临界值、,
#警惕,埃默格。
日志级别警告
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
根:~#
我只是想创建一个403文档,指向任何方向都会非常有帮助。我再次道歉,这看起来太简单了,我的google fu不够强大,无法找到与“creating 403 error htaccess causes 500 error”精确匹配的资源。指令只允许在服务器上下文中使用(即httpd.cont、apache2.conf、虚拟主机配置或操作系统的类似服务器级配置文件)
考虑到.htaccess
已经在目录上下文中,这一点很有意义
有关目录
指令的更多信息,请查看此链接:
我猜您的ErrorDocument
指令不起作用,因为您没有为conf文件中的目录设置AllowOverride FileInfo
。这是在指定目录中启用ErrorDocument和其他文件级指令所必需的
有关AllowOverride
的更多信息,请参阅此链接:
除非你有特定的理由把你的指令放在<代码> .HTAccess < /C>中,你可以考虑把它们放在CONF文件中的<代码>块中,并为所有目录制作<代码> AuthOpRoad < /C> >代码> No.< /代码>。这从性能的角度来看是更好的。因为TEH服务器不需要检查A中的每个目录。请求的层次结构以查找.htaccess
说明。
查看Apache错误日志。那里应该有与500错误相关的更多详细信息。
标记不允许出现在.htaccess中