htaccess除IP外的所有内容的阻止卷曲/ Wget [英] htaccess Block Curl/Wget for all but IP

查看:53
本文介绍了htaccess除IP外的所有内容的阻止卷曲/ Wget的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以阻止所有对curl和wget请求的访问,但仍然允许IP地址通过?

Is there a way I can block all access to curl and wget requests, but still allow an IP address through?

这是我到目前为止的内容:

Here's what I have so far:

RewriteCond %{HTTP_USER_AGENT} ^pycurl [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Wget [NC,OR]

虽然这些确实可以进行阻止,但我希望能够允许使用1个IP地址

While these definately do the blocking, I'd like to be able to allow 1 IP address to utilize these.

推荐答案

将条件更改为:

RewriteCond %{HTTP_USER_AGENT} ^pycurl [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Wget [NC]
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$ 

其中1.2.3.4是您不想使用的IP块。

where the 1.2.3.4 is the IP you don't want to block.

这篇关于htaccess除IP外的所有内容的阻止卷曲/ Wget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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