Hello, I created a htaccess and passed it at the root of the html directory. I even set it so that apache is the owner of the file. However, I am still able to hotlink to my image or pdf file. What could be the problem? Please see my htaccess file below.
Thanks for your assistance.
#prevent viewing of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
#prevent directory listing
IndexIgnore *
#custom error message
ErrorDocument 401 /custom-error/401.php
ErrorDocument 403 /custom-error/403.php
ErrorDocument 404 /custom-error/404.php
ErrorDocument 500 /custom-error/500.php
#prevent hotlinking to images (gif, png, jpg), documents (csv, pdf, xls, xlsx) and web files (javascript: js, css)
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^
https://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|png|jpg|csv|pdf|xls
|xlsx|js|c
ss)$ - [F]
As to why it dosen't work, loose the first Http_referer condition, as that's allowing BLANK referer strings.