title: Codeigniter with SSL not working
body: <p>I have tried most of the solutions for Codeigniter with SSL and none of them worked.</p>
  
  <p>What I need is the whole website running under SSL, it's a website with a lot of forms and showing data from a database, like an admin section, so the only resources used are css, js, and some images, nothing else.</p>
  
  <p>This is what I have in my config.php file.</p>
  
  <pre><code>$config['base_url'] = 'https://admin.example.ie/';
  </code></pre>
  
  <p>Main .htaccess</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
  
  order deny,allow
  deny from all
  allow from 86.XXX.XXX.XXX
  </code></pre>
  
  <p>application/.htaccess</p>
  
  <pre><code>Options -Indexes
  Options +FollowSymLinks
  &lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteBase /
  
      #Removes access to the system folder by users.
      #Additionally this will allow you to create a System.php controller,
  
      RewriteCond %{REQUEST_URI} ^system.*
      RewriteRule ^(.*)$ index.php?/$1 [L]
  
      #When your application folder isn't in the system folder
  
      RewriteCond %{REQUEST_URI} ^application.*
      RewriteRule ^(.*)$ /index.php?/$1 [L]
  
      #Checks to see if the user is attempting to access a valid file,
      #such as an image or css document, if this isn't true it sends the
      #request to index.php
  
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?/$1 [L]
  &lt;/IfModule&gt;
  &lt;IfModule !mod_rewrite.c&gt;
      ErrorDocument 404 /index.php
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>This works partially.</p>
  
  <p>This is the var_dump($_SERVER) when accesing the homepage.</p>
  
  <pre><code>["FCGI_ROLE"]=&gt; string(9) "RESPONDER" 
  ["HTTPS"]=&gt; string(2) "on" 
  ["SSL_TLS_SNI"]=&gt; string(28) "admin.example.ie" 
  ["HTTP_HOST"]=&gt; string(28) "admin.example.ie" 
  ["HTTP_USER_AGENT"]=&gt; string(72) "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) 
  ["HTTP_CONNECTION"]=&gt; string(5) "close" 
  ["SERVER_SIGNATURE"]=&gt; string(74) " Apache Server at admin.example.ie Port 443" 
  ["SERVER_SOFTWARE"]=&gt; string(6) "Apache" 
  ["SERVER_NAME"]=&gt; string(28) "admin.example.ie" 
  ["SERVER_ADDR"]=&gt; string(15) "XXX.XXX.XXX.XXX" 
  ["SERVER_PORT"]=&gt; string(3) "443" 
  ["REMOTE_ADDR"]=&gt; string(11) "86.XXX.XXX.XXX" 
  ["REMOTE_PORT"]=&gt; string(5) "58332" 
  ["GATEWAY_INTERFACE"]=&gt; string(7) "CGI/1.1" 
  ["SERVER_PROTOCOL"]=&gt; string(8) "HTTP/1.1" 
  ["REQUEST_METHOD"]=&gt; string(3) "GET"
  </code></pre>
  
  <p>So as I can see SSL is working here.
  However if I put my login and password(the homepage is only an login page) and go to the home page for logged users I lose the secured connection.</p>
  
  <pre><code>["FCGI_ROLE"]=&gt; string(9) "RESPONDER" 
  ["REDIRECT_STATUS"]=&gt; string(3) "200" 
  ["HTTP_HOST"]=&gt; string(28) "admin.example.ie" 
  ["HTTP_USER_AGENT"]=&gt; string(72) "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0" 
  ["HTTP_CONNECTION"]=&gt; string(5) "close" 
  ["SERVER_SIGNATURE"]=&gt; string(73) "Apache Server at admin.example.ie Port 80" 
  ["SERVER_SOFTWARE"]=&gt; string(6) "Apache" 
  ["SERVER_NAME"]=&gt; string(28) "admin.example.ie" 
  ["SERVER_ADDR"]=&gt; string(15) "217.XXX.XXX.XXX" 
  ["SERVER_PORT"]=&gt; string(2) "80" 
  ["REMOTE_ADDR"]=&gt; string(11) "86.XXX.XXX.XXX" 
  ["REMOTE_PORT"]=&gt; string(5) "58392" 
  ["REDIRECT_URL"]=&gt; string(15) "/employee/home" 
  ["GATEWAY_INTERFACE"]=&gt; string(7) "CGI/1.1" 
  ["SERVER_PROTOCOL"]=&gt; string(8) "HTTP/1.1" 
  ["REQUEST_METHOD"]=&gt; string(3) "GET" 
  ["REQUEST_URI"]=&gt; string(15) "/employee/home" 
  </code></pre>
  
  <p>Any ideas on why is this happening. We can hand over this project to the client with this security breach.</p>