Codeigniter已尝试过多种方法从url中删除index.ph然后无效

时间:2014-02-11 05:45:51

标签: php codeigniter

如果我是用户

http://myproject/index.php/control/one

如果我改为

,它将起作用
http://myproject/control/one

这里给出错误

Not Found

The requested URL /myproject/da/topic_c was not found on this server.
Apache/2.2.3 (CentOS) Server at 10.0.2.139 Port 80

我在本地使用

我没有将我的.httaccess文件设置为

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

其余项目很好......

2 个答案:

答案 0 :(得分:0)

你可以试试这个,这是我的Codeigniter .htaccess文件

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
AddHandler php5-script .php

答案 1 :(得分:0)

您是否在config.php中删除了index_page变量的值? 转到application / config / config.php找到$ config ['index_page'] ='index.php';并用$ config替换['index_page'] ='';