A few clients have recently complained about other blogs linking to their images and leeching off their bandwidth. Bandwidth is expensive and should be protected.
Here’s a working solution:
location ~ \.(jpg|jpeg|bmp|jif|bmp|gif|png)$ {
root /path/to/public_html/;
valid_referers server_names none blocked;
if ($invalid_referer) {
return 403;
}
}
Some sites will need to allow some other sites to link to their images. If this is the case you can use the following rewrites – just modify and add domains as required
location ~ \.(jpg|jpeg|bmp|jif|bmp|gif|png)$ {
root /path/to/public_html/;
valid_referers server_names none blocked www.theothersite.com *.theothersite.com;
if ($invalid_referer) {
return 403;
}
}



Amy from
Tara from
Stephanie from
Kelly from