[Mongrel] Modifying Apache Conf To Block Leachers

Jens Kraemer kraemer at webit.de
Fri Feb 23 05:01:03 EST 2007

On Thu, Feb 22, 2007 at 10:28:46AM -0800, Hunter Hillegas wrote:
> Howdy,
> I'm using Apache 2.2 + Mongrel with great success, using the sample  
> configs from the Mongrel site.
> We have some MP3s on the site and recently someone has been stealing  
> them and basically leaching them from the site, linking to them from  
> an off-site location.
> I've been trying to modify my Apache conf to check the referrer and  
> adjust accordingly as below but no luck. I'm wondering if someone  
> else has any suggestions on getting this to work... I would expect  
> this to send the user to error.html if the referrer is not the site  
> in question but nothing at all happens...
> Any suggestions appreciated, this stuff drives me batty.
> URL: http://www.mysite.com/audio_file/the_audio_file/file.mp3
> RewriteCond %{REQUEST_FILENAME} .*mp3$ [NC]
> RewriteCond %{HTTP_REFERER} !^$
> RewriteCond %{HTTP_REFERER} !mysite\.com [NC]
> RewriteCond %{HTTP_REFERER} !friendlysite\.com [NC]
> RewriteCond %{HTTP_REFERER} !google\. [NC]
> RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
> RewriteRule (.*) /error.html

try appending [L] to the RewriteRule above. And be sure to enable
rewrite logging to debug such things:

RewriteLog /path/to/logfile
RewriteLogLevel 4 

and be sure to disable logging once it works - these logs tend to grow
to enormous sizes fast :-)


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
kraemer at webit.de | www.webit.de
Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa

More information about the Mongrel-users mailing list