本文介绍了htaccess“打破”包括HTTP 451的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 对于我的网页,我有一个 .htaccess 文档,看起来像这样 < Files .htaccess> 命令允许,否认拒绝所有< / Files> ErrorDocument 404 /websites/404/index.php 现在到目前为止据我了解,你可以通过添加另一行来包含更多 ErrorDocument 。例如 < Files .htaccess> 命令允许,否认拒绝所有< / Files> ErrorDocument 404 /websites/404/index.php ErrorDocument 503 /websites/maintenance/index.php 但是,当我尝试为 HTTP 451 使用以下代码行 ErrorDocument 451 /websites/451/index.php并重新加载我的页面我得到一个服务器错误!错误500 。后来我发现这是因为 XAMPP 不再使用 .htaccess 文件并且错误只能通过为错误451 ErrorDocument 来解决$ C>。是什么导致这种情况,我该如何解决它? 注意 我也发现这种情况发生在错误418:我是茶壶以及 编辑 仅仅包含一些关于我正在使用的软件的信息。我正在使用 XAMPP控制面板v3.2.2 Apache 2.4.17 - 这是版本与XAMPP一起提供 解决方案即使有很多HTTP状态码由IANA正式维护),并不是所有的网络服务器都支持这些。从Apache 2.4开始,Apache不支持状态码418和451,并且默默地将其转换为错误500. Apache 2.4中支持的最新状态代码是414和501和400的崩溃预防(从 Apache 2.4更改日志): $ b core:支持HTTP 501和414状态码的自定义ErrorDocuments。 PR 57167 [Edward Lu] core:在a无效的CONNECT请求的情况下防止服务器崩溃状态码为400的自定义错误页面使用服务器端包括。 PR 58929 [Ruediger Pluem] 查看支持的HTTP状态码列表(从Apache 2.4.4开始)。 查看关于的旧bug(针对2.2提交)将自定义状态代码重新映射到500个错误。 请参阅(也适用于Apache 2.2)。 For my web page, I have a .htaccess document which looks like this<Files .htaccess>order allow,denydeny from all</Files>ErrorDocument 404 /websites/404/index.phpNow as far as I understand it you can include further ErrorDocument by just adding another line. For example<Files .htaccess>order allow,denydeny from all</Files>ErrorDocument 404 /websites/404/index.phpErrorDocument 503 /websites/maintenance/index.phpHowever, when I try to add a page for HTTP 451 using the following line of code ErrorDocument 451 /websites/451/index.phpand I reload my page I get a Server error! Error 500. I later found out this was because XAMPP was no longer picking up my folder with the .htaccess file in and the error could only be resolved by removing the ErrorDocument for error 451. What is causing this and how can I fix it?NoteI also found that this happens for error 418: I'm a teapot as wellEditJust to include a little more information about the software I am using. I am using XAMPP Control Panel v3.2.2Apache 2.4.17 - This is the version which comes with XAMPP 解决方案 Even though there are a lot of HTTP status codes (which are officially maintained by the IANA), not all webservers support all of these. As of Apache 2.4, the status codes 418 and 451 are not supported and silently converted to error 500 by Apache.The latest additions of supported status codes in Apache 2.4 are 414 and 501 and a crash prevention for 400 (from 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]See the list of supported HTTP status codes (as of Apache 2.4.4).See an older bug (filed against 2.2) regarding remapping of custom status codes to 500 errors.See this previous question regarding a similar problem (but also with Apache 2.2). 这篇关于htaccess“打破”包括HTTP 451的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-19 08:49