title: Set up the base url in codeigniter
body: <p>I have the directory structure like this in code igniter:</p>
  
  <pre><code> Appsite
      -website
         -application
          -images
  </code></pre>
  
  <p>When I accessing the image in index.php I used:
  <code>&lt;img src="http://localhost/Appsite/website/images/images.PNG"</code></p>
  
  <p>And the href is:
   <code>&lt;li class=""&gt;&lt;a href="http://localhos/tAppsite/website/index.php/home/"&gt;Home&lt;/a&gt;&lt;/li&gt;</code></p>
  
  <p>I think it is not a good practice to include the <code>http://localhost</code> when accessing the images or libraries in code igniter. So I tried to change the <code>$config['base_url']</code>  in <code>config.php</code> 
  to <code>$config['base_url'] = "http://".$_SERVER["HTTP_HOST"]."/";</code></p>
  
  <p>And now I update my image source and other library source I remove the localhost and the name of my directory folder:</p>
  
  <p><code>&lt;img src="images/images.PNG”&gt;</code>
  <code>&lt;li class=""&gt;&lt;a href= &lt;?php echo base_url;?&gt;  /website/index.php/home/"&gt;Home&lt;/a&gt;&lt;/li&gt;</code></p>
  
  <p>But I get errors. it says object not found. Can some help me? </p>