Google Answers Logo
View Question
 
Q: .htaccess - help setting up an exception ( No Answer,   0 Comments )
Question  
Subject: .htaccess - help setting up an exception
Category: Computers > Internet
Asked by: johndarnielle-ga
List Price: $10.00
Posted: 30 Nov 2006 05:48 PST
Expires: 30 Dec 2006 05:48 PST
Question ID: 786975
I have a music website where I put some tracks up for streaming, using
Odeo (www.odeo.com). Assuming my website is www.rockmusic.com, all the
.mp3 files are in www.rockmusic.com/audio. I don't upload the tracks
to Odeo, I just use their "link to audio" option, which will embed a
flash player on my website that'll stream the mp3's straight from my
server. Here's the odeo.com embedded code:

<embed src="http://odeo.com/flash/audio_player_tiny_black.swf"
quality="high" width="145" height="25" name="audio_player_tiny_black"
align="middle" allowScriptAccess="always" wmode="transparent" 
type="application/x-shockwave-flash"
flashvars="audio_id=3920973&#038;audio_duration=
256.0&#038;valid_sample_rate=true&#038;external_url=http://www.rockmusic.com/audio/Rock
Song.mp3" pluginspage=" http://www.macromedia.com/go/getflashplayer"
/></embed>

That is working just fine, but www.rockmusic.com/audio is open,
meaning anybody can go there and download all the mp3's. Even worse,
people are starting to hotlink to the mp3's in there.

First thing I tried to do was password protect /audio using .htaccess.
I did just that, using an excellent tutorial on wikipedia
(http://en.wikipedia.org/wiki/Htaccess ). It did solve the problem,
except that the odeo flash player wouldn't work anymore, and thus I
had to take it back.

What I'm trying to accomplish here is:

1) Forbid direct navigation to www.rockmusic.com/audio (either by
password protecting it or by redirecting it to www.rockmusic.com)

2) Forbid hotlinking to anything in www.rockmusic.com/audio

3) Allow the odeo.com flash player to access the mp3's in www.rockmusic.com/audio.

4) Accomplish 1, 2 and 3 with a single .htaccess file on the root dir
of my web directory.

I don't know what version of Apache my server runs, but I'm hosted by
Dreamhost, just in case that helps.

By following another worthy tutorial (
http://underscorebleach.net/jotsheet/2004/11/stop-image-hotlinking-tutorial-htaccess-apache)
I ended up with this .htaccess file, but it doesn't do what I want:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !odeo\. [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.mp3) http://www.rockmusic.com/images/no_hotlinking.gif [R,NC,L]


If anyone can help, it will be greatly appreciated.. I don't earn a
buck with my website, and it consumes way too much time, but even so I
can't get this thing to work right. Thanks a lot!

Regards,
Bruno
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy