IIS htaccess规则转换器仅导入1条规则 [英] IIS htaccess rule converter only importing 1 rule

查看:103
本文介绍了IIS htaccess规则转换器仅导入1条规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个示例 .htaccess 文件(在此处),并用不良的机器人阻止。这是该文件中的一个小示例代码块:

I have a example .htaccess file (found here) with bad robots to block. Here's a small sample code block from that file:

#bad bots start
#programmed by tab-studio.com public  version 2017.12
#1 new rule every 500 entries
RewriteCond %{HTTP_USER_AGENT} \
12soso|\
192\.comagent|\
1noonbot|\
zuibot|\
zyborg|\
zyte\
 [NC]
RewriteRule .* - [F]
#bad bots end

基本上将 403 扔到网址匹配。我查看了这篇文章,以了解如何转换这些。 htaccess 规则通过IIS重写 web.config 规则。
但是,导入规则时,我得到了意外的结果,似乎没有规则可以转换,请参见下图。我在做什么错了?

Basically throwing a 403 on a URL match. I checked this post to see how I can convert these .htaccess rules to a web.config rewrite rule via IIS. When I import the rules however, I get an unexpected result where no rules seem to be converted, see image below. What am I doing wrong?

img src = https://i.stack.imgur.com/frbr1.png alt =在此处输入图片描述>

推荐答案

在king和回车符上肯定很窒息。如果尝试以下操作,则会看到它应该正确导入:

It's certainly choking on the \ and the carriage return. If you try the following you'll see it should import properly:

#bad bots start
#programmed by tab-studio.com public  version 2017.12
#1 new rule every 500 entries
RewriteCond %{HTTP_USER_AGENT} 12soso|192\.comagent|1noonbot|zuibot|zyborg|zyte
 [NC]
RewriteRule .* - [F]
#bad bots end

,您可以考虑使用请求过滤和改为扫描标题:> ://docs.microsoft.com/zh-cn/iis/configuration/system.webserver/security/requestfiltering/filteringrules/filteringrule/scanheaders/

Having said that, you might consider looking at using Request Filtering & Scan Headers instead: https://docs.microsoft.com/en-us/iis/configuration/system.webserver/security/requestfiltering/filteringrules/filteringrule/scanheaders/

这篇关于IIS htaccess规则转换器仅导入1条规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆