Forum Moderators: phranque

Message Too Old, No Replies

How do I restrict access to my downloads?

         

casper_2k3

9:02 pm on Mar 6, 2004 (gmt 0)

10+ Year Member



I have a large number of downloads on my site and I am worried about download hotlinking.

I want to restrict access to my downloads, so that you can only download them from either of my sites: www.site1.com and www.site2.co.uk.

I know that .htaccess can do this but I haven't got a clue as to what the code should be.

Any help would be very much appreciated!

Casper

casper_2k3

11:03 pm on Mar 6, 2004 (gmt 0)

10+ Year Member



can anyone help me then with this query?

kevinpate

11:37 pm on Mar 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know, but would it be possible to acheive your goal in the same manner you can use to block hotlinking of images?

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}! ^http://www.mydomain.com/.*$ [NC]
RewriteRule .*\.(.*doc¦pdf¦txt¦xls¦mp3¦otherextension)$ [mydomain.com...] [R,NC]

caveat: forum software breaks the vertical pipe and loses some spaces, so you want to be sure to not just copy and paste the above.