bdl
01-23-2010, 05:21 PM
Is it possible to have different actions based on the referrer? What I'd like to do is prevent hotlinking on all images on our domain, but from a specific domain (e.g. ebay.com), I want a different action. Let's say the normal action is to simply force a 403, if coming from a different referrer I want to show an alternate image ("bandwidth thief", etc).
Here's my current, working config:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?ourdomain\.com/.*$ [NC]
RewriteRule \.(gif|jpe?g|swf|flv|bmp|png)$ - [NC,F,L]
Now, I'm guessing that you have to alter the referrer higher up in the chain, then the default fallthrough action will force 403, but I don't know how to implement it.
Here's my current, working config:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?ourdomain\.com/.*$ [NC]
RewriteRule \.(gif|jpe?g|swf|flv|bmp|png)$ - [NC,F,L]
Now, I'm guessing that you have to alter the referrer higher up in the chain, then the default fallthrough action will force 403, but I don't know how to implement it.