title: How do I specify the protocol in an anchor and still use relative path?
body: <p>It is always preferred on a personal website to use relative paths in anchors so that you can easily move your directory structure to a new website, but I want to make part of my website password protected (using .htaccess) and hence use https. Is there a way in an anchor's href to specify a different protocol <strong>without</strong> hard-coding the <code>www.domain.com</code> as well?</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;a href="/student/example"&gt;Link&lt;/a&gt;
  </code></pre>
  
  <p>I want to turn it into something like:</p>
  
  <pre><code>&lt;a href="https: /student/example"&gt;Link&lt;/a&gt;
  </code></pre>
  
  <p>The above obviously doesn't work. Is there any way to do it? I am trying to avoid any scripting but would appreciate a JavaScript more than PHP or ASP.</p>