Cách 1:

Code:


RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://([^.]+.)?domain.com/ [NC]
RewriteCond %{HTTP_USER_AGENT} !(googlebot-image|msnbot|psbot|yahoo-mmcrawler) [NC]
RewriteRule .(bmp|gif|jpe?g|png)$ – [NC,F]

Cách 2:

Code:


RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://([^.]+.)?domain.com/ [NC]
RewriteCond %{HTTP_USER_AGENT} !(googlebot-image|msnbot|psbot|yahoo-mmcrawler) [NC]
RewriteCond %{REQUEST_URI} !^/hotlink.png$
RewriteRule .(bmp|gif|jpe?g|png)$ /hotlink.png [L]