In my .htaccess, it return 403 if user accesses image directly, but allows them to be displayed on site. I've read (htaccess) How to prevent a file from DIRECT URL ACCESS? in order to achieve this.
This is my .htaccess
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?myapp.dev/ [NC]
RewriteRule \.(gif|jpg|JPG|jpeg|png)$ - [F]
Options -Indexes
What I want to do next is that if the url contains "pdf" (e.g. myapp.dev/pdf/stuff.png) I will not use or skip this code
RewriteRule \.(gif|jpg|JPG|jpeg|png)$ - [F]
Maybe I could modify the RewriteCond or the RewriteRule
and add a condition...
Any ideas/alternatives will be of help!