How can I stop people from hotlinking to files on my server. they made me run out of bandwidth by doing that =(
Looking on google I found out this: RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L] Where mysite.com is your site. It should block requeststo jpe?g|gif|bmp|png files from other sites, and replace it with /images/nohotlink.jpe. Hope this helps!
Wel you can add in this line RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L] The extensions you want to block. Try it out and let us know if it works!
this migght be more difficult. how could I redirect them to my homepage instead of getting a 404 when they try to access the file if someone is hotlinking to them.
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L] You can replace /images/nohotlink.jpe with the url of the home (i.e. index.htm), but you could get something bad, for example if someone is hotlinking an image in a webpage. Anyway for mpe and zip files it should work.
Could I a dd 2 rewrite conditions? RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L] and RewriteRule .*\.(zip|avi|rar|midi|mp3)$ /index.php [L]