RewriteRule[F,L]在Apache日志中显示500,而不是403



我正在阻止htaccess文件中的坏机器人。检查头,我正确地看到返回的403,但在我的访问日志中,我看到的是500而不是403:

x.x.x.x - - [04/Aug/2020:10:56:02 -0600] "GET /testurl HTTP/1.1" 500 - "" "Yeti/1.0 (NHN Corp.; http://help.naver.com/robots/)"

此外,在Apache错误日志中,我看到:

[Tue Aug 04 10:56:02.896243 2020] [core:error] [pid 10430:tid 47402182534912] [client x.x.x.x:35589] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

我的htaccess文件的示例部分:

RewriteCond %{HTTP_USER_AGENT} ^.*(bot1|bot2).*$ [NC,OR]
...
RewriteRule ^(.*)$ - [F,L]

在规范化或https重定向之前,首先要处理这些规则。我不明白为什么这会导致";10个内部重定向";根据错误日志。

提前谢谢。

我发现了这个问题。糟糕的机器人程序重写被重定向到我的403页面,但由于重写规则中包括了所有文件,因此包括了403页面。在机器人程序的RewriteCond列表的顶部,我包含了以下内容,这些内容解决了问题。

RewriteCond %{REQUEST_URI} !^/my-403-page.html$

最新更新