I got a problem regarding setting my server settings so that my files can't be accessed from people linking directly to the files, but can when they click a link on my website to open the file.
I tried this:
RewriteCond %{HTTP_REFERER} !^http://19.24.3.13/~child/ [NC]
RewriteCond %{HTTP_REFERER} !^http://19.24.3.13/~child/.*$ [NC]
RewriteRule \.(pdf|doc|docx)$ /~child/ [L]
Problem is, when I want to open these files via my website, I get an error, because the link to the file is a direct link, something I wanted to prevent.
So to counter this, I need to let through the referrals from my own website. I tried this:
SetEnvIf Referer "^http://19.24.3.13/~child/.*$" legit_referal
SetEnvIf Referer "^$" legit_referal
<LocationMatch "\.(pdf|doc|doxc)$" >
Order Deny,Allow
Deny from all
Allow from env=legit_referal
</LocationMatch>
But with no success. I get a server 500 error if I try to access it.
As you can see I use ip-adresses, because I have no domain name, only the ip.
Can someone point me in the right direction?
SetEnvIf Referer "^http://yourdomain.com" legit_referal
?