The RPG Maker Resource Kit

RMRK General => General Chat => Topic started by: Tezuka on March 12, 2008, 10:43:00 PM

Title: Dissalowing hotlinking from certain sites?
Post by: Tezuka on March 12, 2008, 10:43:00 PM
I don't know how I can add more detail to this, but how do I only allow some sites to hotlink my files?
Title: Re: Dissalowing hotlinking from certain sites?
Post by: Roph on March 13, 2008, 01:27:03 AM
Crankeye download servers use this in the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?crankeye\.com/ [nc]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?2drpg\.com/ [nc]
RewriteRule .*\.(zip|exe|png|wmv)$ http://crankeye.com/ [nc]


Explanation ~

RewriteCond %{HTTP_REFERER} !^$

ANY http referrer will be interpreted by the following rules

RewriteCond %{HTTP_REFERER} !^http://(www\.)?crankeye\.com/ [nc]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?2drpg\.com/ [nc]


Here you add sites you WANT to be allowed to hotlink. The [nc] means No Condition if this is met. Basically, they get a free pass =)

RewriteRule .*\.(zip|exe|png|wmv)$ http://crankeye.com/ [nc]

Simple enough, add more file types if you like. After the $ is what you want the requests to be written to, in this case the crankeye.com frontpage =) This has an [nc] on it incase you have extra rules in your htaccess file following these. This way these ones won't be caught up in those. It's a good idea to cover your ass when you're dealing with multiple sets of rules. It can get confusing or you can get nasty server errors.

RMRK.net isn't included in the exceptions, try these to see it in action:

http://d1.crankeye.com/95.zip
http://d2.crankeye.com/95.zip
http://d3.crankeye.com/95.zip

Lol RPG Maker 95, been on them for longer than I can remember, just never added to the download page.
Title: Re: Dissalowing hotlinking from certain sites?
Post by: Tezuka on March 13, 2008, 09:45:33 AM
Awesome, thanks Roph!

+rep
Title: Re: Dissalowing hotlinking from certain sites?
Post by: Tezuka on March 13, 2008, 10:29:20 AM
Awesome!

But if say I wanted to disallow access to the domain all together, how would I do that?
Title: Re: Dissalowing hotlinking from certain sites?
Post by: Kokowam on March 17, 2008, 10:21:50 PM
Lol rmxp-like. Proxy. :V