title: Root-relative links in HTML sites that work both locally and on the web
body: <p>Root-relative links are usually accomplished by prefacing a <code>href</code> attribute with <code>/</code>, like so:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;a href="/path_to_file"&gt;
  </code></pre>
  
  <p>The problem is that this doesn't work with locally run sites, as the <code>/</code> will link to actual root of the computer's filesystem rather than the website's base URL.</p>
  
  <p>Is there a way to make root-relative links that function properly not only in traditional web-hosted cases but also when run locally?</p>