.htaccess Can';t在codeigniter框架中从url(IP地址)中删除index.php

.htaccess Can';t在codeigniter框架中从url(IP地址)中删除index.php,.htaccess,codeigniter,.htaccess,Codeigniter,我在htaccess文件中使用了下面的代码来从codeigniter框架的url中删除index.php RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] 它在本地运行得很好,但在live中,我使用IP地址访问我的站点,所以它不会删除index.php您可以试试这个 RewriteEngine on RewriteCond %{REQUES

我在
htaccess
文件中使用了下面的代码来从codeigniter框架的url中删除
index.php

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
它在本地运行得很好,但在live中,我使用IP地址访问我的站点,所以它不会删除
index.php

您可以试试这个

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

您应该使用CodeIgniter中的路由来执行此操作


我希望您有
$config['index\u page']=''
在配置文件中。将.htaccess文件放在应用程序文件夹之外
index.php
在哪里?它是在任何文件夹中还是在公用文件夹中打开?确保
.htacces
具有与
index.php
文件相同的路径。如果您正在使用IIS,则
.htacces
将无法工作。IIS不读取
.htacces
。使用
web.config
文件。