title: CodeIgniter 3 sessions destroy after page refresh
body: <p>Despite the countless similar questions here, non of them works in my case. So, I decided to post it here.</p>
  
  <p>Well the problem is that the session is being destroy after page refresh/redirect. </p>
  
  <p>I'm using the XAMPP server(latest version with PHP 7.x) on Windows 10, I think, its the problem with codeigniter settings but, I just test the traditional session code (without Codeigniter) and that works fine.</p>
  
  <p><strong>Traditional PHP Code (Works Fine)</strong></p>
  
  <pre><code>session_start();
  if(!isset($_SESSION['admin'])) {
      $_SESSION['admin']='test';
      die('session not set, set it now');
  }
  else {
      echo $_SESSION['admin'];
  }
  </code></pre>
  
  <p><strong>Codeigniter Code (Here is the Problem)</strong></p>
  
  <pre><code>if($this-&gt;session-&gt;userdata('admin')) {
      echo $this-&gt;session-&gt;userdata('admin');
  }
  else {
      $this-&gt;session-&gt;set_userdata('admin', 'test');
      echo 'session not set, set it now';
  }
  </code></pre>
  
  <p><strong>Codeigniter Session Config</strong></p>
  
  <pre><code>$config['sess_driver'] = 'files';
  $config['sess_cookie_name'] = 'ci_session';
  $config['sess_expiration'] = 7200;
  $config['sess_save_path'] = 'C:\\xampp\\htdocs\\application\\cache\\session\\';
  $config['sess_match_ip'] = FALSE;
  $config['sess_time_to_update'] = 300;
  $config['sess_regenerate_destroy'] = FALSE;
  </code></pre>
  
  <p><strong>NOTE</strong> The Same Codeigniter code works fine on WAMP Server - Windows 10</p>