.htaccess - redirect requests from a certain IP only

前端 未结 1 1581
礼貌的吻别
礼貌的吻别 2021-01-15 20:08

I believe someone is scraping images from my site. So what I want to do is, based on their specific IP address, serve up some kind of holding image instead of the actual im

相关标签:
1条回答
  • 2021-01-15 20:28

    Try this mod_rewrite rule:

    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} =12.34.56.78
    RewriteRule !^images/foobar\.png$ images/foobar.png
    

    This rule will rewrite any request from the IP address 12.34.56.78 that is not /images/foobar.png internally to /images/foobar.png.

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