<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Place of design &#187; snippet</title>
	<atom:link href="http://www.placeofdesign.com/tag/snippet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.placeofdesign.com</link>
	<description>Putting your business on the web</description>
	<lastBuildDate>Thu, 13 May 2010 13:26:30 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Beating the image hotlinker</title>
		<link>http://www.placeofdesign.com/beating-the-image-hotlinker</link>
		<comments>http://www.placeofdesign.com/beating-the-image-hotlinker#comments</comments>
		<pubDate>Mon, 02 Feb 2009 10:26:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Superb links and snippets]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[bandwidth image theft]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[hotlinking]]></category>
		<category><![CDATA[referer]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[URL]]></category>

		<guid isPermaLink="false">http://www.placeofdesign.com/blog/?p=59</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>So some really (not) nice guy decides to hotlink the main image the front page of our website, and then claim to offer to work with photographers and graphic designers whilst having no content of his own&#8230; Quite flattering, but also nicking our bandwidth</p>
<p><strong>To begin, lets run over how we figured this out.. </strong></p>
<p><strong></strong><span id="more-59"></span></p>
<p><strong>What is a hot link?<br />
</strong>A hot link is where another website essentially displays YOUR image on THIER web space without copying it.  What they do is LINK to it, so essentially your site is serving the image onto their web page.  This consumes your websites bandwidth, and is essentially stealing</p>
<p>We looked at our logs, specifically the section called &#8220;Links from an external page&#8221; (other web sites excluding search engines.  It is good practice to review your logs regularly, as you can tell all sorts of useful things ranging from the efficiency of your SEO through to who is hot linking images from your site</p>
<p><strong>What did we do?</strong><br />
Well we have a fairly neat way of combating this, using the good old .htaccess file &#8211; we simply dropped in the following code into the .htaccess code in the root directory of our website:</p>
<blockquote><p>RewriteEngine on<br />
RewriteCond %{HTTP_REFERER} !^$<br />
RewriteCond %{HTTP_REFERER} !^http://(www\.)?placeofdesign\.com(/)?.*$ [NC]<br />
RewriteRule \.(gif|jpe?g|png|bmp)$ naughtyfolder/imagetoreplacehotlinkedimage\.jpg[L,NC]</p></blockquote>
<p>What this code does is basically <strong>swap the hot linked image</strong>, with the following image found in the naughty folder &#8211; how cool is that! This means that the following image is now being displayed on the offending webpage, and untill they notice, and remove the link to our image</p>
<p><a href="http://www.placeofdesign.com/blog/wp-content/uploads/2009/02/humiliatingimage1.gif"><img class="alignnone size-medium wp-image-61" title="naughty image" src="http://www.placeofdesign.com/blog/wp-content/uploads/2009/02/humiliatingimage1-300x118.gif" alt="humiliatingimage1 300x118 Beating the image hotlinker " width="300" height="118" /></a></p>
<p><strong>How does this code work?</strong><br />
To begin we turn on the Mod Rewriting engine &#8211; this allows you to transform URLs from one thing to another at the server level.  The code then conditionally looks at the the referrer.  In the case the referring URL is not from our domain name, we replace the image served with an alternative</p>
<p><strong>Why not just block the IP address?</strong><br />
Blocking the IP address would achieve the same result, but we would have to do this for each infringement one by one.  For sure it is a good option for serial offenders.  The other issue with IP addresses is that they are recycled.  The sort of organisation that hotlinks images, will just move server, or get booted off their server.  The last thing we want to do is block a valid referrer.  This is why this method is cool, because we are not blocking ranges of IP addresses to our domain and driving away potentially valid traffic</p>
<p><strong>How about if we want the images to be hot linked?</strong><br />
In the instance where we wanted to allow an image to be hot linked &#8211; for example a photographer posting an image on a forum for critique, then you can allow more domains by adding more allowed domain into the conditional part of the code</p>
<blockquote><p>Example: RewriteCond	%{HTTP_REFERER}	!myfavephotography website\.com			[NC]</p></blockquote>
<p><strong><br />
Or if you wish to allow Google to show your images in the image search:</strong></p>
<blockquote><p>RewriteCond	%{HTTP_REFERER} 	!^http://(www\.)?google\.			[NC]</p></blockquote>
<p><strong>The complete code in this instance would be:</strong></p>
<blockquote><p>RewriteEngine on<br />
RewriteCond %{HTTP_REFERER} !^$<br />
RewriteCond %{HTTP_REFERER} !^http://(www\.)?placeofdesign\.com(/)?.*$ [NC]<br />
RewriteCond	%{HTTP_REFERER}	!^http://(www\.)?myfavephotographywebsite\.com			[NC]<br />
RewriteCond	%{HTTP_REFERER} !^http://(www\.)?google\.			[NC]<br />
RewriteRule \.(gif|jpe?g|png|bmp)$ naughtyfolder/imagetoreplacehotlinkedimage.jpg[L,NC]</p></blockquote>
<p>Feel free to leave a comment or drop us an email if you have any questions</p>
]]></content:encoded>
			<wfw:commentRss>http://www.placeofdesign.com/beating-the-image-hotlinker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
