View Full Version : .HTAccess question....

04-19-2003, 06:29 PM
Not sure if this is the right place to ask, but I couldn't find anything related to this anywhere else...

With regards to blocking people from hotlinking to files on a server, an alternate method is available to show an alternate image if someone tries to hotlink.
Is it possible to configure the htaccess file to only show an alternate image to a certain IP, rather than everyone who hotlinks?
So if for instance, if everyone viewed...


But I wanted IP ( as an example) to view

http://myserver.com/image1.jpg, instead, is that possible?

04-25-2003, 10:47 PM
If you are going to block that IP, it would be easier just to block the IP completely, rather than just images (since chances are if you want to block certain IPs, those IPs are probably pretty bad siphons).

Just do

<Limit GET>
order allow,deny
allow from all
deny from 123.456.789.012
deny from 124.457.

Note that the second 'deny from' would block a smaller octet set (meaning anything matching the first 2 octet sets, and any wild cards in the 3rd and 4th positions).

If it is from another site you could try the standard mod_rewrite rules, but add

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www.thiefsite.com(:80)?$

(I've never tried this option, if I'm denying anything by IP, I'd rather block the IP from everything, but the second option should still work)

12-03-2003, 05:59 PM
Maybe this will help

I've been looking for a way to prevent image hotlinking via IIS. I've looked around for awhile and have not had any luck.

My hosting has win2k IIS running ASP 3, without ASP.net. Anyone tried and succeeded with a free solution?

I've had ppl link to images on my site and its chewing up my bandwidth.