dpaanlka
10-10-2008, 10:12 PM
I have a server with a lot of zip, hqx and dmg files and other compressed archives that people can download. I find that a ton of sites on the internet hotlink to my files, so I've installed the following in my .htaccess to bring anyone clicking on a hotline to a page that says "Thanks for downloading from my site" and then begins the download automatically. This way I can get a little recognition for my hosting, without breaking any of the thousand of remote links that exist:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?info-mac\.org/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(forums\.)?info-mac\.org/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(error\.)?info-mac\.org/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(archive\.)?info-mac\.org/ [NC]
RewriteRule ^([^.]+\.(zip|hqx|sit|dmg|iso|bin))$ http://www.info-mac.org/download.html?file=$1 [NC]
I just set this up earlier today, and it all seemed to be working fine until I started coming across the occasional remote site with hotlinks to my files that do not redirect as they should, they simply download the files.
For example, this site (http://www.polhode.com/info-mac.html) contains two links to files on my server (the hyperarchive links - which actually is another older server that redirects to my new server). Those two work fine, redirecting you to a page on my site that gives me some recognition, after which the download begins automatically. However, this site (http://www.faqs.org/faqs/compression-faq/part1/section-2.html) also has several hotlinks to similar files on my site (search for hyperarchive.lcs.mit.edu to find them) and none of them redirect at all! They just start downloading the files.
Why on earth is my .htaccess treating these two different referers differently? The only difference that I can see between these two sites in the example above are one is located at a .org address. Based on my code, could this be playing a role somehow?
Any help would be much apprecated.
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?info-mac\.org/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(forums\.)?info-mac\.org/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(error\.)?info-mac\.org/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(archive\.)?info-mac\.org/ [NC]
RewriteRule ^([^.]+\.(zip|hqx|sit|dmg|iso|bin))$ http://www.info-mac.org/download.html?file=$1 [NC]
I just set this up earlier today, and it all seemed to be working fine until I started coming across the occasional remote site with hotlinks to my files that do not redirect as they should, they simply download the files.
For example, this site (http://www.polhode.com/info-mac.html) contains two links to files on my server (the hyperarchive links - which actually is another older server that redirects to my new server). Those two work fine, redirecting you to a page on my site that gives me some recognition, after which the download begins automatically. However, this site (http://www.faqs.org/faqs/compression-faq/part1/section-2.html) also has several hotlinks to similar files on my site (search for hyperarchive.lcs.mit.edu to find them) and none of them redirect at all! They just start downloading the files.
Why on earth is my .htaccess treating these two different referers differently? The only difference that I can see between these two sites in the example above are one is located at a .org address. Based on my code, could this be playing a role somehow?
Any help would be much apprecated.