title: Session Timeout redirect in Codeigniter
body: <p>So I'm having trouble getting a redirect to the login page when a session has timed out to work in Codeigniter. This is probably a really basic mistake on my part, but the code I'm using in my controller is:</p>
  
  <pre><code>if(!$this-&gt;session-&gt;userdata('is_logged_in')) {
      redirect('login/');
  }
  </code></pre>
  
  <p>It works as far as redirecting the user to the login page, but keeps looping back to the login page. Why is this?</p>