title: How can I configure Sitecore so that it generates absolute links to media items?
body: <p><code>&lt;sc:Image&gt;</code> and <code>&lt;sc:FieldRenderer&gt;</code>, when rendering a MediaItem, generate html code that looks like the following:</p>
  
  <pre><code>&lt;img src="~/media/twitter.gif" alt="Twitter" width="100" height="22" /&gt;
  </code></pre>
  
  <p>Notice the relative path used in <code>src</code> attribute: this means that when such an image is reused on multiple pages, the browser has to fetch it multiple times (e.g. on page <a href="http://example.com/" rel="noreferrer">http://example.com/</a> and <a href="http://example.com/about-us/" rel="noreferrer">http://example.com/about-us/</a>). When I generate the <code>img</code> tag in code, I can use the following snippet to force an absolute URL:</p>
  
  <pre><code>string url = Sitecore.StringUtil.EnsurePrefix('/',
      Sitecore.Resources.Media.MediaManager.GetMediaUrl(media));
  </code></pre>
  
  <p>How can I configure Sitecore to force the leading slash in media urls?</p>
  
  <p>Using Reflector I can see that <code>MediaOptions.AbsolutePath</code> controls the behaviour that I want to achieve, but I don't know how can I set it for Sitecore built-in controls. Setting <code>Media.MediaLinkPrefix</code> or <code>mediaPrefixes</code> in <code>web.config</code> doesn't seem to change anything.</p>