Hotlinking is a way to take images or other files and embed them directly into a website that doesn't own those files. In other words, it is an unauthorized use of someone else's bandwidth. 
When hotlinking is detected and you need to serve some unexpected alternate content, add the following code to your .htaccess file. This will protect all files of the types included in the last line (add more types if needed):
# stop hotlinking and serve alternate content
<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http://(www.)?domain.com/.*$ [NC] 
RewriteRule .*.(gif|jpg)$ http://www.domain.com/donotsteal.jpg [R,NC,L]
</ifModule>
To deliver a standard (or custom, if configured) error page instead of some yucky, but funny image, replace the line containing the RewriteRule in the .htaccess directive with the following line:

# serve a standard 403 forbidden error page
RewriteRule .*.(gif|jpg)$ - [F,L]
To grant linking permission to a site other than yours, insert this code block after the line containing the domain.com string. Remember to replace goodsite.com with the actual site domain:
# allow linking from the following site
RewriteCond %{HTTP_REFERER} !^http://(www.)?goodsite.com/.*$ [NC]