Reputation: 1
I am writing and rewriting my htaccess and does not work properly, it is still possible to listen to my mp3 files from an external website with a direct link:
DirectoryIndex index.html
RewriteEngine On
RewriteCond %{HTTP_HOST} ^frenchspanishonline.com$ [NC]
RewriteRule ^(.*)$ http\:\/\/www\.\ frenchspanishonline\.com\/$1 [R=301,L]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?frenchspanishonline.com/.*$ [NC]
RewriteRule \.(jpg|jpeg|png|gif|swf|mp3|css)$ - [NC,F,L]
order allow,deny
deny from atirchad.com
deny from 66.96.144.190
allow from all
I managed to block swf files but not mp3 ones, don't know why! If I write a specific Rewriterule to the site I want to block, it blocks my own website! any help?
Upvotes: 0
Views: 246
Reputation: 1
I found that
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} atirchad\.com [NC]
RewriteRule .* - [F]
blocks mp3 in Chrome, Firefox and IE but not in Safari.
Upvotes: 0
Reputation: 17521
The truth is, you can control it, but only in a limited way, unfortunately.
Your current solution relies on http referer header - which may and mey not be sent. It's up to end browsers to decide if they will provide you tracking information or not.
Thus, there is no 100% working solution.
The problem here is probabkly that the first rewrite condition is true and so it won't jump to the next one.
Upvotes: 1
Reputation: 5159
If you are using cpanel, there is "HotLink Protect" feature. If you really want to use following code:
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://jmsliu.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://jmsliu.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
At least, it works for me. I hope it can help you as well.
Thanks
Upvotes: 0