0

I wanted to block direct access to mp3 files and I am using this code:

RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC] 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC] 
RewriteRule \.(gif|jpg)$ - [F]

taken from this answer:

It is working exactly how I need BUT when I load my site from any mobile device, the mp3 files won't play.

Any ideas?

Thanks!

Community
  • 1
  • 1
ranslobo
  • 57
  • 7
  • I dont seem any issue at all,restart your apache server that reloads the .htaccess which should solve your issue. its just throttle :) – BetaCoder Dec 26 '13 at 11:01
  • @BetaCoder .htaccess should be dynamically loaded. Only the main configuration file is only read on startup of the service. – Sumurai8 Dec 26 '13 at 13:18
  • @ranslobo The second condition does match exactly all cases the first condition covers. The rule seems correct, apart from the fact that you are matching images instead of mp3 files. The documentation suggests `RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"`. Check what requests are actually made and what the referer is in them. Could you have misspelled your hostname or the protocol? – Sumurai8 Dec 26 '13 at 13:23
  • @ranslobo dont confuse him with HTTP_HOST as he already uses localhost instead , while i am assuming that his pregma (gif|jpg|mp3) is working in Desktop as he previously mentioned that - the mp3 files won't play in MOBILE DEVICE – BetaCoder Dec 26 '13 at 13:32
  • Im Sorry but I did put 'mp3' instead of 'gif|jpg' but still cant read the file from mobile devices.... – ranslobo Dec 28 '13 at 18:36

0 Answers0