mod rewrite - Block bad bots with mod_rewrite and save in blacklist

I have a WP site in a shared hosting server (LAMP stack).Receiving a lot of 404 errors (security plugin log file) for bo

I have a WP site in a shared hosting server (LAMP stack).

Receiving a lot of 404 errors (security plugin log file) for bots looking for non-existing wp-login url (Ex. example/en/wp-login.php).

Trying to block them with a rewrite rule like this:

   RewriteCond %{REQUEST_URI} /en/wp-login\.php$
   RewriteRule ^.* - [F]

1) I would need to catch all possible calls to wp-login.php (any subdirectory /en/ /fr/ and so on...)

A condition like this should work?

    RewriteCond %{REQUEST_URI} ^(.*)/wp-login\.php$

2) I would like to save automatically all bad bots IPs in a blacklist as soon as they look up for wp-login.php file.

I've found this script to create a blacklist and lookup for IPs in order to block them:

    RewriteMap    hosts-deny  "txt:/path/to/hosts.deny"
    RewriteCond   "${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}" "!=NOT-FOUND" [OR]
    RewriteCond   "${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}" "!=NOT-FOUND"
    RewriteRule   "^"  "-"  [F]

Any idea on how to save automatically IPs in deny-hosts file?

Thanks for any advice.

Regards

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745186498a4615661.html

相关推荐

  • mod rewrite - Block bad bots with mod_rewrite and save in blacklist

    I have a WP site in a shared hosting server (LAMP stack).Receiving a lot of 404 errors (security plugin log file) for bo

    1天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信