Hypertext Access file Denying Access Hot Link Prevention


Example

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|css)$ - [F]

This blocks all the links to '.gif', '.jpg' and '.css' files which are not from the domain name http://www.yourdomain.com.

Display alternate content:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.yourdomain.com/angryman.jpg [R,L]

This blocks all links to '.gif' and '.jpg' files which are not from the domain name 'http://www.yourdomain.com/' and displays the file 'http://www.yourdomain.com/angryman.jpg' instead.