title: codeigniter redirect when not login
body: <p>I'm trying to make a login process in codeigniter because I'm new to it and want to familiarize myself with it. Then I want to add a security feature where if the dashboard is accessed using the URL, if the session of <code>account_id</code> is not set I will redirect them to login:</p>
  
  <pre><code> public function index() {
  
      if ($this-&gt;session-&gt;userdata('account_id') === FALSE ) {
  
  
        redirect('/');
      }    
  
      return $this-&gt;_renderPage();
  }
  </code></pre>
  
  <p>but then it gives me this result
  <img src="https://i.stack.imgur.com/FXaKB.png" alt="enter image description here"></p>
  
  <p>As you can see it's still in the dashboard but its all blank page and it did not redirect.
  How can I fix this?</p>
  
  <p>Thanks in advance for the help.</p>