How can I prevent hotlinking specific files from other sites?
Lets say mydomain.com/file1.zip
and mydomain.com/file2.zip
- I would like to redirect them to pages mydomain.com/file1page
and mydomain.com/file2page
.
I want to prevent only those 2 of hotlinking not all the zip files.
Asked
Active
Viewed 706 times
-1
-
2[What have you tried?](http://whathaveyoutried.com) – Havelock Oct 15 '12 at 14:22
1 Answers
0
You can check against the referer but those can easily be spoofed. So something like:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/
RewriteRUle ^/?(file1|file2).zip$ /$1page [L,R=302]
So if the referer doesn't start with http://mydomain.com/
and the request is for either file1.zip
or file2.zip
, redirect to either file1page
or file2page
.

Jon Lin
- 142,182
- 29
- 220
- 220