<?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>BraveNewCode Inc. &#187; images videos</title>
	<atom:link href="http://www.bravenewcode.com/tag/images-videos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bravenewcode.com</link>
	<description>You dream it up, we code it to life.</description>
	<lastBuildDate>Mon, 30 Aug 2010 19:35:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Block External Suckage Of Your Images, Prying Eyes</title>
		<link>http://www.bravenewcode.com/2008/05/block-external-suckage-of-your-images-prying-eyes/</link>
		<comments>http://www.bravenewcode.com/2008/05/block-external-suckage-of-your-images-prying-eyes/#comments</comments>
		<pubDate>Tue, 06 May 2008 22:56:10 +0000</pubDate>
		<dc:creator>Dale Mugford</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[images videos]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.bravenewcode.com/?p=126</guid>
		<description><![CDATA[Holy server resources and bandwidth suckage Batman! Seriously- hot-linking to your images and media files from search engines and other sites can be a good thing- but also a very bad thing, depending on what it is that being hot-linked and whether or not you want there to be external linking to your file(s).
In the [...]]]></description>
			<content:encoded><![CDATA[<p>Holy server resources and bandwidth suckage Batman! Seriously- hot-linking to your images and media files from search engines and other sites <em>can</em> be a good thing- but also <strong>a very bad thing</strong>, depending on what it is that being hot-linked and whether or not you want there to be external linking to your file(s).</p>
<p>In the best case scenario, it drives traffic to your site and helps advertise for you, freely. In the worst case scenario you piss off your webhost and in turn have outages.<br />
<span id="more-126"></span></p>
<div class="spacer"></div>
<h3>NOT AN ISSUE</h3>
<p>Case in point: BraveNewCode. We <em>want</em> people to link to our downloads, our images, and so on. It&#8217;s good advertising for us, and our web setup is such that it won&#8217;t really become a problem for us, for now anyways.</p>
<div class="spacer"></div>
<h3>TOTALLY AN ISSUE</h3>
<p>Case in point: <a href="http://www.matthewgood.org">matthewgood.org</a>. For Matt&#8217;s site, this is a big problem, especially when you consider 404 errors pointed at non-existent files sucking up bandwidth. </p>
<p>Matt gets a lot of traffic- he&#8217;s been a top blog in Canada for years and years- and as such there are links to his site and content that stretch way back. He&#8217;s also well indexed by all search engines, and that means that every image &#038; video sitting in a directory on the server needs to be controlled in terms of external access- otherwise he&#8217;d be well over the monthly server resource limits allocated to him by Media Temple and his modest shared-server grid plan.</p>
<p>In order to control just who has access to what files, we&#8217;ve implemented an .htaccess rule for certain folders which restricts the ability for external sites to index, view, and link to them successfully.</p>
<p>The rule looks like this, inside each .htaccess file in each folder you want to restrict access to:</p>
<p><code><br />
RewriteEngine on<br />
RewriteCond %{HTTP_REFERER} !^$<br />
RewriteCond %{HTTP_REFERER} !^http://(www\.)?bravenewcode.com [NC]<br />
RewriteRule \.(png|gif|jpeg|jpg|tiff|psd|flv|mpg|mpeg|mp3)$ - [NC,F]<br />
</code></p>
<div class="spacer"></div>
<p>The first line here turns on mod_rewrite on your server once per .htaccess file.</p>
<p>The next line is needed to allow proxy caches. If you take it out, then anyone <em>without a referer</em> won?t be able to view your site. Many proxy caches, for instance, block referers? <strong>and that looks the same as a directly-entered URL.</strong></p>
<p>The third tells the .htaccess file where to allow image files to be served from &#8211; in this case it will allow images be served from <em>http://bravenewcode.com</em> and <em>http://www.bravenewcode.com</em> (remember to update this for your own domain!).</p>
<p>The final line is case insensitive (the NC) and instructs the .htaccess file what file types to restrict the serving of. The F in the square brackets forces the current URL to be forbidden.</p>
<div class="spacer"></div>
<h3>PEEPING BROWSERS</h3>
<p>Lastly, if you want to ensure that someone can&#8217;t browse a directory just by entering it as a URL in a browser (visit <a href="http://www.bravenewcode.com/example/">http://www.bravenewcode.com/example/</a> to see what we mean), you can add this bit of code to the bottom of your .htaccess files to ensure folks can&#8217;t peep your naked goods:</p>
<p><code><br />
&lt;Files .htaccess&gt;<br />
order allow,deny<br />
deny from all<br />
&lt;/Files&gt;<br />
</code></p>
<p>Another option if your server is set up so that it allows overrides is to add this line to your .htaccess file:</p>
<p><code><br />
Options -Indexes<br />
</code></p>
<p>That instructs your webserver not to allow directory-style listings in that directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravenewcode.com/2008/05/block-external-suckage-of-your-images-prying-eyes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
