title: Unable to use CSS/JS with CodeIgniter PHP Framework
body: <p>It's a very common problem and I looked in to many other SO questions but none of them were able to solve my problem.</p>
  
  <p>The CSS/JS won't load and the site crashes with a 400 (Bad Request) and a 500 (Internal Server Error).</p>
  
  <p><strong>Project Structure (in Atom Editor):</strong></p>
  
  <p><a href="https://i.stack.imgur.com/fBPtl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fBPtl.png" alt="enter image description here"></a></p>
  
  <p><strong>feedController.php:</strong></p>
  
  <pre><code>&lt;?php if (!defined("BASEPATH")) exit("No direct script access allowed");
  
  class feedController extends CI_Controller {
      public function loadfeed() {
        $this-&gt;load-&gt;view('header');
        $this-&gt;load-&gt;view('footer');
        $this-&gt;load-&gt;view('feed');
      }
  }
  </code></pre>
  
  <p><strong>feed.php:</strong></p>
  
  <p>I removed the <code>&lt;head&gt;</code> and Css Links and Js script code lines and added them to the header.php file</p>
  
  <p><strong>header.php:</strong></p>
  
  <pre><code>&lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  
      &lt;title&gt;
          &lt;?php if(isset($meta_title) &amp;&amp; !empty($meta_title)) echo $meta_title; ?&gt;
      &lt;/title&gt;
  
      &lt;?php
      echo link_tag('assets/css/bootstrap.min.css');
      echo link_tag('assets/font-awesome/css/font-awesome.css');
      echo link_tag('assets/css/plugins/toastr/toastr.min.css');
      echo link_tag('assets/js/plugins/gritter/jquery.gritter.css');
      echo link_tag('assets/css/style.css');
      ?&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p><strong>footer.php:</strong></p>
  
  <pre><code>&lt;?php ?&gt;
  
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="&lt;?php echo base_url('assets/js/jquery-2.1.1.js')?&gt;"&gt;&lt;/script&gt;
  &lt;script src="&lt;?php echo base_url('assets/js/bootstrap.min.js')?&gt;"&gt;&lt;/script&gt;
  &lt;script src="&lt;?php echo base_url('assets/js/plugins/metisMenu/jquery.metisMenu.js')?&gt;"&gt;&lt;/script&gt;
  &lt;script src="&lt;?php echo base_url('assets/js/plugins/slimscroll/jquery.slimscroll.min.js')?&gt;"&gt;&lt;/script&gt;
  </code></pre>
  
  <p><strong>config.php (Located in application/config/config.php):</strong></p>
  
  <pre><code>//I added localhost as my base_url
  $config['base_url'] = 'http://localhost/';
  </code></pre>
  
  <p>I believe that is all? Yet, I get a <strong>BLANK WHITE page</strong> with console errors saying Bad Request and Internal Server error (pointing to my header.php file).</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tried this solutions given below, but now I get a error message on the page saying this:</p>
  
  <blockquote>
    <p>An uncaught Exception was encountered</p>
    
    <p>Type: Error</p>
    
    <p>Message: Call to undefined function link_tag()</p>
    
    <p>Filename: C:\xampp\htdocs\codeig\application\views\header.php</p>
    
    <p>Line Number: 11</p>
  </blockquote>
  
  <p><strong>Line Number 11 points to the header.php's echo link_tag('assets/css/bootstrap.min.css');</strong></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I added:</p>
  
  <pre><code>$this-&gt;load-&gt;helper('html');
  $this-&gt;load-&gt;helper('url');
  </code></pre>
  
  <p>to my controller's method and the Page Loaded. However, No Styles or JavaScripts were loaded. <strong>404 Errors</strong> are shown in the console</p>