How do I block other domains from loading my images?
How do I block other domains from loading my images?
A strategy for what you want, would be to create an intermediary page to load your images, this way you can detect the origin of the request, below I'll put an example in PHP.
<?php
if(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'http://www.seusite.com.br') === 0 && isset($_GET['img'])){
$name = './imagens/' . $_GET['img'];
$fp = fopen($name, 'rb');
header("Content-Type: " . mime_content_type($name));
header("Content-Length: " . filesize($name));
fpassthru($fp);
exit;
}
?>
Example of a page of yours using the image:
<img src="imagens.php?img=icone.jpg" />
To be more effective you have to block in apache direct access to the images folder and its files.