I have a server i am using to host a bunch of zip files download
A lot of websites have been putting direct links to my zip files. I'm trying to find a way to redirect all incoming trafic from external websites because i want to put a page to display a message before users can download the file.
So let's say the file is www.mydomain.com/somefile.zip
If someone try to access this file from an external domain, i would want to redirect them to www.mydomain.com/download.php?file=somefile.zip
In other words, it should be impossible to download the .zip file except if you are being redirected from www.mydomain.com/download.php
Download.php will display some message with a link to download the file. So the htaccess must only redirect the trafic coming from other domains. If the user try to access somefile.zip from www.mydomain.com
then he must not be redirected or else it will fall in a loop.