I want to give 403 error to specific extension if someone try to access it directly or try to include my file in third-party website/ cross website.
Example :
let say, example.com
is my website and it have a image file happy.png so i want if someone visit example.com/happy.png it should display 403 error and also it should not be used in any other domain like <img src="http://example.com/happy.png" />
except my domain example.com
. Only my domain should use my assets.
i want to deny txt, png, jpg, jpeg, ico, css, js etc
.htaccess code :
<FilesMatch ".txt", "png", "css", "js">
Order Allow,Deny
Deny from All
</FilesMatch>
OR
<FilesMatch ".(htaccess|htpasswd|ini|psd|log|sh)$">
Order Allow,Deny
Deny from all
</FilesMatch>
What wrong with my code? why it not working as i want?