I’m using this .htaccess in my root to redirect everything to index.php
RewriteEngine On
RewriteRule !\.(mp3|js|ico|txt|gif|jpg|png|css)$ index.php
Then in my directories .htaccess I use this to block direct access
RewriteEngine On
deny from all
Then to get my html5 audio to play, I put this .htaccess in the audio directory
RewriteEngine On
deny from all
allow from index
But when I put the same .htaccess file in my javascript directory I don’t have access to my js files. Why does it work for the audio directory but not this one?
Thanks in advance! 🙂
This is because you’re accessing javascript file from your client computer. MP3 file loads from server side and it allows that approach. That is why you’re getting 403 forbidden page. Try to deny it by HTTP_REFERER: