Google Answers Logo
View Question
Q: .htaccess - help setting up an exception ( No Answer,   0 Comments )
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 ( Assuming my website is, all the
.mp3 files are in 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 embedded code:

<embed src=""
quality="high" width="145" height="25" name="audio_player_tiny_black"
align="middle" allowScriptAccess="always" wmode="transparent" 
Song.mp3" pluginspage=""

That is working just fine, but 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
( ). 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 (either by
password protecting it or by redirecting it to

2) Forbid hotlinking to anything in

3) Allow the flash player to access the mp3's in

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 (
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]

# END WordPress

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !odeo\. [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.mp3) [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!

There is no answer at this time.

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 with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

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