簡體   English   中英

Codeigniter中的.htaccess在遠程服務器中不起作用

[英].htaccess in Codeigniter is not working in remote server

.htaccess文件在我的本地主機上工作正常,但是當我將其上傳到遠程服務器上時,重定向無法正常工作。

當我以任何用戶身份登錄,然后嘗試從站點注銷時,它再次顯示我已登錄,但在本地Web服務器上運行正常

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> 

這是我的注銷控制器

  <?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');
}
}?>

.htaccess在我的CI項目中運行良好:

<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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM