Codignier无法删除远程服务器上的index.php

时间:2013-12-18 10:12:32

标签: .htaccess codeigniter

我正在使用codeigniter。我成功删除了localhost上的index.php,但它不能在远程服务器上运行。

当我尝试拨打:http://website.com/user/login时,它会给我[未找到文件]。但是当我输入http://website.com/index.php/user/login

时它会起作用

我将所有文件放在www文件夹中,这是我的.htaccess:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [PT,L]

有人可以帮我吗? 感谢。

2 个答案:

答案 0 :(得分:1)

这是我使用的.htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

您是否检查过远程服务器上的.htaccess文件是否正确并且正在读取该文件?

答案 1 :(得分:0)

这对我有用:

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

config.php

$config['uri_protocol'] = 'AUTO';

这将从localhost和远程服务器中删除 index.php

相关问题