gpt4 book ai didi

php - htaccess "breaks"包含 HTTP 451 的参数

转载 作者:可可西里 更新时间:2023-11-01 00:29:52 28 4
gpt4 key购买 nike

对于我的网页,我有一个如下所示的 .htaccess 文档

<Files .htaccess>
order allow,deny
deny from all
</Files>

ErrorDocument 404 /websites/404/index.php

现在据我了解,您可以通过添加另一行来进一步包含 ErrorDocument。例如

<Files .htaccess>
order allow,deny
deny from all
</Files>

ErrorDocument 404 /websites/404/index.php
ErrorDocument 503 /websites/maintenance/index.php

但是,当我尝试为 HTTP 451 添加页面时使用以下代码行 ErrorDocument 451/websites/451/index.php 并重新加载我的页面,我收到一个 服务器错误!错误 500。后来我发现这是因为 XAMPP不再使用 .htaccess 文件获取我的文件夹,并且只能通过删除 error 451ErrorDocument 来解决错误。是什么原因造成的,我该如何解决?


注意
我还发现error 418: I'm a teapot as well


编辑
只是为了包含更多关于我正在使用的软件的信息。我正在使用

  • XAMPP 控制面板 v3.2.2
  • Apache 2.4.17 - 这是 XAMPP 附带的版本

最佳答案

尽管有很多 HTTP 状态代码(officially maintained by the IANA),但并非所有网络服务器都支持所有这些。从 Apache 2.4 开始,状态代码 418 和 451 不再被 Apache 支持并自动转换为错误 500。

Apache 2.4 中最新添加的受支持状态代码是 414 和 501 以及 400 的崩溃预防(来自 Apache 2.4 change log ):

core: Support custom ErrorDocuments for HTTP 501 and 414 status codes. PR 57167 [Edward Lu ]

core: Prevent a server crash in case of an invalid CONNECT request with a custom error page for status code 400 that uses server side includes. PR 58929 [Ruediger Pluem]

请参阅 list of supported HTTP status codes (从 Apache 2.4.4 开始)。

请参阅有关 remapping of custom status codes to 500 errors 的旧错误(针对 2.2 提交) .

查看此 previous question regarding a similar problem (还有 Apache 2.2)。

关于php - htaccess "breaks"包含 HTTP 451 的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38811962/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com