I am trying to prevent hot linking of images and adding allowed hosts by RewriteMap in txt file dynamically, but unfortunately the condition is not working.
Here is code of VirtualHost
<VirtualHost *:80>
DocumentRoot D:\XAMPP\htdocs\test\base
ServerName base.test.dev
RewriteEngine On
RewriteMap allowedhosts "txt:D:\XAMPP\htdocs\test\base/rules.txt"
</VirtualHost>
and following is htaccess code
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^${allowedhosts:$1} [NC]
RewriteRule \.(gif|jpg|jpeg|bmp|png)$ - [F]
and following is txt file line for host to allow to access images
http(s)?://(www\.)?base.test.dev
Please someone help me.
Thanks.