Codeigniter删除linux服务器中的index.php


Codeigniter remove index.php in linux server

当我在本地机器上粘贴.htaccess文件代码时,它可以很好地工作,就像我的url在没有index.php的情况下也可以,但当我将相同的代码上传到linux服务器时,url再次需要index.php。有人能指导我如何在linux服务器上删除index.php吗。。。

这是我的.htaces代码

RewriteEngine on
RewriteCond $1 !^(index'.php|resources|robots'.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]  

这是我的.htaccess代码,我解释说这在我的本地windows机器上可以很好地工作,但当我将相同的代码上传到linux服务器时,我的rounding引擎就不能工作了

  1. 确保在你的服务器上打开了mod重写
  2. 还要确保.htaccess文件位于index.php所在的同一文件夹中

在htaccess文件上添加此代码

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index'.php|images|js|uploads|css|robots'.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

希望这个代码有帮助!!!

我建议将.htaccess设置在与应用程序文件夹相同的级别,并在其中放入以下代码。

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]