title: How to unset session value in codeigniter
body: <p>Some users should redirect to their profile . 
  to Prevention loop page,  I should unset user session data .
  but by my code, user redirected to <code>/profile/settingsProfile</code> page then page refreshed again and again .</p>
  
  <p>my code:</p>
  
  <pre><code>    $data['redirectToProfile'] = $this-&gt;session-&gt;userdata('redirectToProfile');
      if($data['redirectToProfile'])
      {
          $this-&gt;session-&gt;unset_userdata('redirectToProfile'); //not work
        //$this-&gt;session-&gt;set_userdata(array('redirectToProfile'       =&gt; false)); // not work
  
          redirect('/profile/settingsProfile', 'refresh');
      }
  </code></pre>
  
  <p>my code placed in before load all views.</p>