I am using Codeigniter for an application and added Tank_Auth as Authentication system.
Locally (XAMPP) things work perfectly (login, logout). On a server though I noticed a bug, when I login , I go through, when I logout, I am redirected to the login page, when I do the same thing right away I login , I am in , I logout .. I am still in, the logout is not working anymore.
I am wondering if this is a cookie/session issue.
my logout function is like this :
function logout()
{
$this->db->cache_delete_all();
$this->tank_auth->logout();
$this->session->sess_create();
//$this->_show_message($this->lang->line('auth_message_logged_out'));
redirect('/auth/login/','refresh');
//$this->_show_message($this->lang->line('auth_message_logged_out'));
}
the only difference between the server verison and the local version is the .htaccess, I am wondering if this has anything to do with that
My htaccess is
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
ExpiresByType application/pdf "access 1 week"
ExpiresByType text/x-javascript "access 1 week"
ExpiresByType application/x-shockwave-flash "access 1 week"
ExpiresByType image/x-icon "access 1 week"
ExpiresDefault "access plus 1 year"
</IfModule>
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
DirectoryIndex index.php
RewriteEngine on
RewriteBase /app/
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/javascript
Any idea ?
Thanks
EDIT : Problem Solved
This was causing the session logout problem ExpiresDefault "access plus 1 year"
After removing this line the authentication worked like a charm