Posts Tagged ‘apache’

Blocking Hotlinked Images for certain domains

Hot linked images has never been much of an issue for this site (salem-news). Having news summarized along with a pictures on a wide variety of sites make blocking of all hot linked images not a possibility.

But a growing number of spam blogs (blogs that do nothing but post pictures, text and links from other sites for the purpose of gaining search ranking) using images from the site required some sort of response.

Using the method from Blocking certain sites from hotlinking images via mod_rewrite

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite1\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite2\.com/ [NC]
RewriteRule \.(jpe?g|gif|png)$ images/no_hotlink.jpg [L]

Is close to what I wanted but preferred to just 403 all referrals from domains by keyword where keyword is the domain name or enough of the domain name to be unique and only block that domain or similar sub domains. I’m not worried about sending a no hot linking allowed image as most likely the sites do not care they are just up to mislead search bots.

RewriteCond %{HTTP_REFERER} (keyword1) [NC,OR]
RewriteCond %{HTTP_REFERER} (keyword2) [NC,OR]
RewriteCond %{HTTP_REFERER} (keyword3) [NC]
RewriteRule ^.* - [F,L]