title: Codeigniter URL and base_url() confusion
body: <pre><code> $config['base_url'] = 'localhost/project';
  
   &lt;link href="&lt;?= base_url(); ?&gt;/css/bootstrap.min.css" rel="stylesheet"&gt;
  </code></pre>
  
  <p>Would produce an error and it won't load my css on my view because of double '/'.</p>
  
  <p>This is the pagesource of the view on a browser.</p>
  
  <pre><code>&lt;link href="localhost/project//css/bootstrap.min.css" rel="stylesheet"&gt;
  </code></pre>
  
  <p>And the css won't load. When i try the page source and follow the link, it leads to 404 error.</p>
  
  <p>What i'm confused about is that when i add protocol on my base_url on config file.</p>
  
  <pre><code>&lt;link href="http://localhost/project//css/bootstrap.min.css" rel="stylesheet"&gt;
  </code></pre>
  
  <p>For reasons unknown, the above url seems to point to the css and it loads on my view even though it still has double '/' on the url between 'project' and 'css'. Also, even if i remove the '/' before the 'css' on the view, it will load, so long as i add a protocol on my base url even though without the protocol even with no double '/' it still won't load the css.</p>
  
  <pre><code>&lt;link href="http://localhost/project/css/bootstrap.min.css" rel="stylesheet"&gt;
  </code></pre>
  
  <p>I also have some questions,</p>
  
  <p>On my config base url above, i never put an '/' at the end so why does it add an '/' when i use the function base_url on my view. Why is it like this?</p>
  
  <p>My 2nd question, is that the '/' on my url.</p>
  
  <pre><code>&lt;link href="css/bootstrap.min.css" rel="stylesheet"&gt;
  
  &lt;link href="/css/shop-homepage.css" rel="stylesheet"&gt;
  </code></pre>
  
  <p>The first link when clicking on the url on the view pagesource on my browser, it still has the controller in the url.</p>
  
  <pre><code>http://localhost/project/Pages/css/bootstrap.min.css
  </code></pre>
  
  <p>While if i add a '/' before the 'css' it removes the 'project' and 'Pages' in the url.</p>
  
  <pre><code>http://localhost/css/shop-homepage.css
  </code></pre>
  
  <p>I could solve the problem just that i don't know why they occur so even though i can get my css to load i don't feel right because i don't know why.</p>