Re: Preventing Direct Downloads [Archive] - ForumsHQ
Posted: Tue Jul 15, 2003 2:06 am
Originally posted by syntax53
n/m i figured it out by using a .htaccess file.
try it: http://www.mudinfo.net/downloads/b2h_v2.3.0.4.zip
here's the file i made incase anyone else wanted to do it. note, this requires apache with support for mod_rewrite:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com/.*$ [NC]
RewriteRule \.(zip|exe)$ http://www.yoursite.com/pathto/errorpage.html [R,L]
(yes i know you can just copy the url and paste it, but that's ok)
Hmm...what do you mean by copy/paste? I'm not seeing that working either...
As for another way to do it, use javascript (yes, I know this isn't as secure, but w/e. TMTOWTDI)
if (document.referrer != 'http://the.page.you.want.the.referrer.to.be') {
location.href = 'http://your.main.page';
}
Now, obviously there's TONS of ways around this type, but it's still going to get 99% of your audience, and it's still a pain in the ass to get around if it's a file you'd want to view/link to a bunch of times.
And example of how to get around it is getting Phantom's maps to direct link. I.e. create your own little frame page that's uses the same linkage as the one on the actual site does with the referrer checker: (maps.html, local file)
Beating the .htaccess referrer is much more difficult. Besides browser bugs (Netscape had (has?) a bad one not too long ago) you're going to have to spoof the http packet sent to the server, which also means you'll have to know what it's looking for. Not too hard, but much more of an asspain than making an html.
Shrug. Sorry, tmi.
n/m i figured it out by using a .htaccess file.
try it: http://www.mudinfo.net/downloads/b2h_v2.3.0.4.zip
here's the file i made incase anyone else wanted to do it. note, this requires apache with support for mod_rewrite:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com/.*$ [NC]
RewriteRule \.(zip|exe)$ http://www.yoursite.com/pathto/errorpage.html [R,L]
(yes i know you can just copy the url and paste it, but that's ok)
Hmm...what do you mean by copy/paste? I'm not seeing that working either...
As for another way to do it, use javascript (yes, I know this isn't as secure, but w/e. TMTOWTDI)
if (document.referrer != 'http://the.page.you.want.the.referrer.to.be') {
location.href = 'http://your.main.page';
}
Now, obviously there's TONS of ways around this type, but it's still going to get 99% of your audience, and it's still a pain in the ass to get around if it's a file you'd want to view/link to a bunch of times.
And example of how to get around it is getting Phantom's maps to direct link. I.e. create your own little frame page that's uses the same linkage as the one on the actual site does with the referrer checker: (maps.html, local file)
Beating the .htaccess referrer is much more difficult. Besides browser bugs (Netscape had (has?) a bad one not too long ago) you're going to have to spoof the http packet sent to the server, which also means you'll have to know what it's looking for. Not too hard, but much more of an asspain than making an html.
Shrug. Sorry, tmi.