IIS htaccess rule converter only importing 1 rule

前端 未结 1 1543
天涯浪人
天涯浪人 2021-01-28 13:55

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         


        
相关标签:
1条回答
  • 2021-01-28 14:43

    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
    

    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/

    0 讨论(0)
提交回复
热议问题