Re: [ILUG] block by referrer

From: Gary Coady (gary at domain netsoc.tcd.ie)
Date: Tue 10 Aug 1999 - 11:32:23 IST


On Tue, Aug 10, 1999 at 10:22:21AM +0000, Rob Hill wrote:
> If I was going the cgi route, the cgi would just check the referrer, and
> give out the file based on that (much easier) but i was hoping that
> there would be an easier (apache) method, as the site's not
> mine, and I would have to write the cgi, as the person involved
> er......couldn't.

I think you might be able to use mod_rewrite

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://your.site/.*$ [NC]
RewriteRule .*\.mp3$ - [F]

That is, if there is a HTTP referer, and it's not from your site, then
forbid access to all MP3s. Well that's completely untested, and basically
comes from http://www.engelschall.com/pw/apache/rewriteguide/
But it should be possible.

-- 
Gary Coady - gary at domain netsoc.tcd.ie - http://www.netsoc.tcd.ie/~gary/
|  It might look like I'm doing nothing, but at the cellular level I'm
|  really quite busy.
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:26 GMT