title: Codeigniter redirect() problem
body: <p>I have created a MY_Controller class to check for sessions.</p>
  
  <p>My LoginController is checking the user information and if that is ok, I redirect the user to the PainelController. I use redirect so my url will be refresh with /localhost/painel instead of /localhost/session/login</p>
  
  <p>The problem is that when I use redirect, I cannot access my session, only using load->view.</p>
  
  <p>Is there a workaround?</p>
  
  <p>Thanks in advance for any help.</p>
  
  <p>PS: I use a .htaccess, the one found on <a href="http://codeigniter.com/wiki/mod_rewrite/" rel="nofollow">CI Wiki</a></p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>class MY_Controller extends CI_Controller {
  
      public function __construct() {
          parent::__construct();
          if(!$this-&gt;session-&gt;userdata('usuario')) {
              redirect('login');
          }
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>Piece of Login: extends CI_Controller</p>
  
  <pre><code>if( $rs )
              {
  
                  $this-&gt;session-&gt;set_userdata('usuario', $usuario);//usuario is a object
                  //$this-&gt;load-&gt;view('painel');//it works
                  redirect('painel', 'location');//it doesn't
              }
              else
              {
                  $this-&gt;load-&gt;view('login', $data = array('mensagem'=&gt;'Usuário ou senha inválidos.'));
              }
  </code></pre>
  
  <p>--</p>
  
  <p>My Painel View</p>
  
  <pre><code>echo $this-&gt;session-&gt;userdata('usuario')-&gt;usuario_nome; //it works
  only if I load-&gt;view('painel')
  </code></pre>
  
  <p>Even if I try to access this session value on my PainelController (extends MY_Controller) it won't work, will say:</p>
  
  <pre><code>Message: main() [function.main]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Usuario" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition
  </code></pre>