[ILUG] block by referrer

kevin lyda kevin at suberic.net
Tue Aug 10 11:10:03 IST 1999


Rob Hill spoke thusly:
>Is it possible, using Apache, to block access to a local website if the browse
>r accessing the files is coming from a particular site?
>Someone copied a users website and is sending viewers to the original site for
> large files (mp3's vids etc)...when asked to remove it, the response was a po
>lite "fuck you".

no, but a cgi (or similar) script might work:

lets say a page has this structure:

   foo.html (contains foo.mp3)

foo.html could become foo.cgi that updates a file with a key, and the
mp3 link could become foo.mp3.cgi?key.  when that link gets followed
the foo.mp3.cgi link could remove the key and deliver the mp3 file.
if the key passed to the foo.mp3.cgi file was invalid, it would fail.

i'm sure there are more efficient varients on the theme (instead of a
key in a file, it could be a file in a directory; some sort of server
side includes could be used (shtml?), etc.), but that's the general
solution that springs to mind.

less exact would be to change the name of the mp3 file every few
hours with a cron job and update the html file with the correct name.
sed is your friend here.

kevin




More information about the ILUG mailing list