Show different image per ip address or user agent
4 posts
• Page 1 of 1
Show different image per ip address or user agent
here's my basic issue. There is a cluster of sites that have a single ip address that are hotlinking... I dont want to block all hotlinking images, but these guys are actually competitors of ours. They all are using the same bot user agent to I guess prefetch the images so it ends up residing on their site.
I want to serve them up an image based on their IP or user agent.
I have this currently in place.
RewriteCond %{HTTP_REFERER} ^http://(www\.)?example\.com(/.*)*$ [NC]
RewriteRule \.(jpeg|JPEG|jpe|JPE|jpg|JPG|gif|GIF)$ /hotlink2.png [L]
the user agent is QippoBot and the ip currently is 176.9.31.72
I'd love to serve up the hotlink image for anything in the 176.9.31.0-176.9.31.255 range.
Can that be done?
I want to serve them up an image based on their IP or user agent.
I have this currently in place.
RewriteCond %{HTTP_REFERER} ^http://(www\.)?example\.com(/.*)*$ [NC]
RewriteRule \.(jpeg|JPEG|jpe|JPE|jpg|JPG|gif|GIF)$ /hotlink2.png [L]
the user agent is QippoBot and the ip currently is 176.9.31.72
I'd love to serve up the hotlink image for anything in the 176.9.31.0-176.9.31.255 range.
Can that be done?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Show different image per ip address or user agent
Hello,
A correct way would be:
The NC-flag makes it case insensitive.
Regards
Andrew
A correct way would be:
- Code: Select all
RewriteCond %{REMOTE_ADDR} ^176\.9\.31\.\d{1,3}$
RewriteRule \.(jpeg|jpe|jpg|gif)$ /hotlink2.png [NC,L]
The NC-flag makes it case insensitive.
Regards
Andrew
- tidaltides
-
- Posts: 24
- Joined: 27 Nov 2012, 21:57
Re: Show different image per ip address or user agent
Case sensitive? You mean if it needs to be upper or lower, you should be certain of it? Thanks for this information.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Show different image per ip address or user agent
Here is the documentation regarding NC-flag.
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 4 guests