Forum Moderators: phranque
I'm trying to get some MP3 files safe in the web environment, using rewriteCond and rules.
The following htaccess seems to block the mp3 downloading and browsing, but the Flash-MP3-player embed in the site, cannot play no more the files. I just need to block the manipulation of these files outside of the web scripts.
I need a help to solve this matter. Sorry for my english.
I've been trying alone since 5 hours.
Thanks so much.
<htaccess>
Options FollowSymLinks
# mod_rewrite in use
RewriteEngine On
RewriteCond %{SCRIPT_URI}!^http://mysite.com/test/index.php$ [NC,OR]
RewriteCond %{SCRIPT_URI}!^http://www.mysite.com/test/index.php$ [NC]
RewriteRule .*\.mp3$ - [F]
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteCond %{REQUEST_URI} ^(/test/component/option,com) [NC,OR]
RewriteCond %{REQUEST_URI} (/¦\.htm¦\.php¦\.html¦/[^.]*)$ [NC]
RewriteRule ^(content/¦component/) index.php
</htaccess>
I'd suggest you rewrite the whole things as:
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/test/index\.php [NC]
RewriteRule .mp3$ - [F]
Jim