的.htaccess - 重定向从某IP请求,只 [英] .htaccess - redirect requests from a certain IP only

查看:258
本文介绍了的.htaccess - 重定向从某IP请求,只的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信有人从我的网站刮的图像。因此,我想要做的是,根据其特定的IP地址,起到了某种控股的实际图像的图像来代替。

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 image.

我如何做到这一点使用的.htaccess?

How do I achieve this using .htaccess?

推荐答案

试试这个mod_rewrite的规则:

Try this mod_rewrite rule:

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

此规则将改写从IP地址12.34.56.78,是不是任何请求 /images/foobar.png 内部以 /图片/ foobar的巴纽

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.

这篇关于的.htaccess - 重定向从某IP请求,只的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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