title: This page isn’t working is currently unable to handle this request. HTTP ERROR 500 in Codeigniter App
body: <p>This is my controller function, When login is clicked the site shoul redirect to
  mysite.com/user/profile</p>
  
  <p>This profile() method is,</p>
  
  <pre><code>public function profile(){
          $this-&gt;user = $this-&gt;session-&gt;userdata("user");
          if(empty($this-&gt;user)){
              redirect('login');
              exit;
          }
  
          $data["user"] = $this-&gt;crud-&gt;get_user($this-&gt;user["ID"]);
          $data["form_error"] = $this-&gt;session-&gt;flashdata('form_error');
          $data["csrf"] = array(
              'name' =&gt; $this-&gt;security-&gt;get_csrf_token_name(),
              'hash' =&gt; $this-&gt;security-&gt;get_csrf_hash()
          );
          $this-&gt;load-&gt;view('user/profile', $data);
          //$this-&gt;load-&gt;view('user/profile-static', $data);
      }
  </code></pre>
  
  <p>This the controller code that redirects to user/profile methos</p>
  
  <pre><code>class Login extends CI_Controller {
  
      public function __construct() {
          parent::__construct();
          $this-&gt;load-&gt;library('email');
          $this-&gt;load-&gt;library('form_validation');
          if(!empty($this-&gt;session-&gt;userdata("user"))){
              redirect('user/profile');
              //redirect('user/profile-static');
              exit;
          }
      }
  </code></pre>
  
  <p>But the page says 
  This page isn’t working
  mysite.com is currently unable to handle this request.
  HTTP ERROR 500
  Please help. TIA</p>