title: Get base_url from main domain and sub domain in codeigniter
body: <p>I have two application for my project</p>
  
  <ol>
  <li>site.com</li>
  <li>api.site.com</li>
  </ol>
  
  <p>And here's my config</p>
  
  <pre><code>$config['base_url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/';
  </code></pre>
  
  <hr>
  
  <p>If I run <strong>site.com</strong>, how to get base_url or site_url of <strong>api.site.com</strong>? </p>
  
  <p>If I run <strong>api.site.com</strong>, how to get base_url or site_url of <strong>site.com</strong>?</p>