Solved .htaccess in a folder

LawsHosting

Verified User
Joined
Sep 13, 2008
Messages
2,422
Location
London UK
I want to block DIRECT access to files in a (two-deep) folder with a custom referrer from a PHP file

Tried
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^https://(www\.)?xxxxx.\com/dir/get-file.php$ [NC]
RewriteRule \.(mp3)$ url/login.php [F]
and
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^$ [NC]
RewriteRule \.(mp3)$ url/login.php [F]
However, none of them seem to function.??‍♂️
 
try

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?xxxxx.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?xxxxx.com.*$ [NC]
RewriteRule \.(mp3)$ - [F]
And put this htaccess in the folder
 
Well, my original code seems to be working now......How strange......

To test, I put gobble-de-gook in it but it didn't cause a 500 error.... When I put gobble-de-gook in my root htaccess, it did 500.... The heck?!
 
Back
Top