title: Base URL in PHP
body: <p>I've got a bit of a dilemma, and it's been bothering me for quite some time. I have a local testing server that's set up like so: <code>127.0.0.1/</code></p>
  
  <p>My website in offline mode looks like this:</p>
  
  <pre><code>127.0.0.1/websitename/index.php
  </code></pre>
  
  <p>My live version of the website looks like this:</p>
  
  <pre><code>websitename.com/index.php
  </code></pre>
  
  <p>I've got the base script for almost all of the links, except for the including header and footer files.</p>
  
  <p>The links in the footer and header files work except for the home page (on the root of the website). </p>
  
  <p>Could anyone redirect me to a proper method of doing multi sub directory base URL linking for both offline and online?</p>
  
  <p>I’ve tinkered around with most of the <code>$_SERVER[]</code> tags and attributes, as well as <code>parse_url()</code>.</p>