无法从Codeigniter URl中删除index.php


Unable to remove index.php from Codeigniter URl

我无法从项目Url中删除index.php。下面是我尝试过的代码。

以下相同的代码和配置设置适用于我在同一服务器上托管的另一个项目

在.htaccess文件中

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index'.php|imgs)
RewriteRule ^(.*)$ index.php/$1 [L]  
RewriteRule ^media/images/([0-9]+)/([A-Za-z0-9-]+).jpg?$ imgs/$1  [T=image/jpeg,L]
<Files "index.php">
AcceptPathInfo On
</Files>

.htaccess文件与应用程序文件夹平行放置在根文件夹下。

在config.php文件中

$config['uri_protocol'] = 'PATH_INFO';
(also tried same for all server global mentioned in config.php)
and
$config['index_page'] = '';

当前项目url类似于http://Hostname/ODP/(此url不适用于以上代码)

以前的项目url是http://Hostname/WCP/(这个用于上面的代码)

Use following htaccess code to remove index.php from your codeigniter url
RewriteEngine on
RewriteCond $1 !^(index'.php|images|robots'.txt|css)
RewriteRule ^(.*)$ ./index.php/$1 [L]