.htaccess File is working fine in my localhost But when I upload it on the remote server the redirection is not working properly.
When I logged in with any user and then try to logout from the site then it is again showing me logged in but it works fine on my local web server
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
<Files "index.php">
AcceptPathInfo On
</Files>
This my logout controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class logout extends CI_Controller {
public function __construct()
{
parent::__construct();
}
function index()
{
$this->home_model->unsetsessions();
redirect('', 'refresh');
}
}?>
This .htaccess is working good in my CI projects:
<IfModule mod_headers.c>
# activate RewriteEngine
RewriteEngine on
# delete index.php from URL
RewriteCond $1 !(index\.php|robots\.txt|humans\.txt|license\.txt|sitemap\.xml|assets)
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
# sitemap.xml to /sitemap
RewriteRule ^sitemap\.xml$ index.php/sitemap [L]
# no-www to www
#change DOMNIO.COM
RewriteCond %{HTTP_HOST} ^DOMNIO.COM$
RewriteRule (.*) http://www.DOMNIO.COM/$1 [R=301,L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 /index.php
</IfModule>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.