NameSilo

Prevent hotlinking without blocking IE users?

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

Miyavi

o-re-sa-maVIP Member
Impact
41
Is there a way to prevent the hotlinking of files without simultaneously blocking IE users?

I have set up hotlinking protection for my site's MP3 files through the .htaccess file. It works great for most browsers, but when anyone tries to download something with IE it doesn't work.

So is there a better solution for preventing hotlinking?

If so, could you please provide instructions or point me in the right direction?

Thank you.
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Still hoping to get some help with this!

Thanks. :D
 
0
Close
That's strange that IE users are unable to download your files if you've disabled hotlinking. What are you putting in htaccess to prevent hotlinking? It could be something else that is making it not work in IE.
 
0
Close
.htaccess definately shouldn't completely block it through IE unless the user has referrer disabled in their browser or something.

What's the code you're using?
 
0
Close
This is the part of my .htaccess file I was using to prevent hotlinking to my mp3 files:

RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$ [NC]
RewriteRule .*\.(mp3)$ http://www.mysite.com/ [R,NC]

With this code IE users were unable to download files from my site, but those who used Firefox and Google Chrome had no problems. This code also made it so that none of my audio streams functioned in any browser. As soon as I removed this code from my .htaccess file both problems went away.

I need to figure out a way to protect my bandwidth and yet not cause things to stop functioning.

Hope someone can help.

Thanks.
 
0
Close
I'd suggest passing it to users through a PHP file, so they never know the true location, then you could integrate that with the user system of your main site?

What are you using for audio-streams? I'd imagine their referrers would be blank?
 
Last edited:
0
Close
How do I pass it to users through a PHP file? That sounds like a good solution if you can point me to a tutorial.

For streaming, I'm using that one that was first released as a Wordpress addon I believe, but can now be found many places:

<script type="text/javascript" language="JavaScript" src="/audio-player.js"></script>
<object type="application/x-shockwave-flash" data="/player.swf" id="audioplayer1" height="24" width="290">
<param name="movie" value="/player.swf" />
<param name="FlashVars" value="playerID=1&soundFile=http://www.mysite.com/song1.mp3" />
<param name="quality" value="high" />
<param name="menu" value="false" />
<param name="wmode" value="transparent" />
</object>
 
0
Close
Would love some more information on this.

Waiting patiently.

Thanks.
 
0
Close
Stop mp3 hotlinking

I assume it is a bit more difficult to stop audio/video hotlinking versus image hotlinking. Try this .htaccess file to stop mp3 hotlinking:

Code:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(mp3|mpg|mp4|mov|wav|wmv)$ - [F,NS,L]

This is a modified version of this htaccess file to stop image hotlinking. Let me know if this version works for you.
 
0
Close
This looks very similar to the code I already posted a few posts ago. Did you read this entire thread? The code you provided seems as if it will also prevent IE users from accessing the files.

I'm quite interested in hearing more about how to pass files to users through a PHP file.
 
0
Close
This looks very similar to the code I already posted a few posts ago. Did you read this entire thread? The code you provided seems as if it will also prevent IE users from accessing the files.
Yes, I did read the entire thread. Did you try the .htaccess file I posted? You said it "seems if it will also prevent IE users" -- did you test it out?

The .htaccess file I posted is different than the .htaccess code you posted.

Your .htaccess code seems to be missing an empty referrer line declaration and is also improperly redirecting to your main site directory rather than giving a server forbidden error to the hotlinking site.

Again, it's difficult to stop hotlinking audio/video files since they are used by browsers in different ways (when compared to images). If this htaccess file doesn't work for you after you test it out, you'll probably want to use a PHP script to manage your site files/downloads as already mentioned.
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back