Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我相信有人正在从我的网站上抓取图像。所以我想做的是,根据他们的特定 IP 地址,提供某种持有图像而不是实际图像。
如何使用 .htaccess 实现这一目标?
试试这个 mod_rewrite 规则:
RewriteEngine on RewriteCond %{REMOTE_ADDR} =12.34.56.78 RewriteRule !^images/foobar\.png$ images/foobar.png
此规则会将来自 IP 地址 12.34.56.78 的任何非/images/foobar.png内部请求重写为/images/foobar.png.
/images/foobar.png