Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: anti leech CGI

by hacker (Priest)
on Oct 30, 2002 at 14:54 UTC ( [id://209088]=note: print w/replies, xml ) Need Help??


in reply to anti leech CGI

What color would you like that wheel you're about to reinvent? chrome? wood? rubber?

There's no need to push this down into the perl side of things, when Apache has facilities built-in that can handle this at the request level. Look into mod_rewrite, and more specifically, the URL Rewriting Guide, specifically the "Blocked Inline-Images" section about 80% of the way down. I use this method on several of my sites, and it works wonderfully (it's not just for images).

To summarize:

<Directory /path/to/domain.org/> AllowOverride None RewriteEngine On RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://domain.org/.*$ [NC] RewriteRule .*\.(png|gz|zip|)$ http://domain.org/no.png [R] </Directory>

Replies are listed 'Best First'.
Re: Re: anti leech CGI
by hiseldl (Priest) on Oct 30, 2002 at 15:13 UTC

    What if your wheel doesn't fit? See my reply to erasei.

    Thanks for the summary of the Apache config though.

    --
    hiseldl
    What time is it? It's Camel Time!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://209088]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found