Smackdown
Posted in Code, Tech
Forenoon watch, 7 bells (11:40 am)

I love laying the smack down on people that try to get away with dirty little evil things online. Today’s example: someone selling our software on eBay, and hotlinking our front page flash demo and images from our site. Basically, they’re using our servers and bandwidth to illegally sell copies of our software.

So I dug down a bit in Apache and implemented a few rules to fix things up. I used to just issue a 403 Forbidden HTTP error when they did this, but I just disabled that rule in favor of today’s new one.

What we do is rewrite requests for any images or flash files coming from eBay to a special image/flash file that helps educate you on the evils of software piracy. Arrrr :)

To test things out, I also implemented it on this site before doing it live. Here’s an example of a normal image, and then a hotlinked image:
Home Designer Pro BoxHome Designer Pro Box

The code for those images is:

<img src="/images/HDProBox.jpg" alt="Home Designer Pro Box" />
<img src="http://www.chiefarchitect.com/HDProBox.jpg" alt="Home Designer Pro Box" />

How do you do it? With Apache, it’s pretty simple. In your conf/httpd.conf, add:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/warning.jpg$
RewriteCond %{HTTP_REFERER} ^http://(www\\.)?bogomip.net/.*
RewriteRule .*\\.(jpg|gif|png)$ http://chiefarchitect.com/warning.jpg

Swap out bogomip.net and chiefarchitect.com as needed. You must have mod_rewrite active for this to work.


2 Responses to “Smackdown”


Gravatar Quoth BenY

Very clever idea!


Gravatar Quoth Webmonster

Thanks, I try. The best part about this kind of solution is the offender has already loaded the files they’re hotlinking, so they don’t see the substitution until their browser cache has expired, but any new visitors see it instantly, it’s brilliant, really.


Leave a Reply (Java required)—Gravatar friendly!