This can be accomplished via the .htaccess file.
Example:
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?alloweddomain.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?alloweddomain2.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?alloweddomain3.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.google.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.googlebot.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.msn.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.msnbot.msn.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.inktomisearch.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.looksmart.com(/)?.*$ [NC]
RewriteRule \.(gif|jpe?g|png|bmp)$ /images/embarrasingimage.gif [L,NC]
1. The following lines allow your domains to hotlink to the pictures (replace "alloweddomain", "alloweddomain2", etc ... with your domain names).
Code:
RewriteCond %{HTTP_REFERER} !^http://(www\.)?alloweddomain.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?alloweddomain2.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?alloweddomain3.com(/)?.*$ [NC]
2. The following lines allow the bots to get to your pictures.
Code:
RewriteCond %{HTTP_REFERER} !^http://(.+)\.google.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.googlebot.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.msn.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.msnbot.msn.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.inktomisearch.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)\.looksmart.com(/)?.*$ [NC]
3. The following line says for all other domains, if someone tries to hotlink to a gif, jpe, jpg, png or bmp ... then replace that image with whatever you have stored at /images/embarrasingimage.gif.
Code:
RewriteRule \.(gif|jpe?g|png|bmp)$ /images/embarrasingimage.gif [L,NC]
I believe this is correct. Just place this code into your .htaccess in every root domain you want protected.