Codeigniter index.php删除导致302发现错误


Codeigniter index.php removal causing 302 found error

我已经为此挣扎了一段时间,并尝试了谷歌所能提供的一切。我的网站可以很好地使用url中的index.php,但出于明显的原因,我想删除它。

在我的.htaccess中,我有我在大多数网站上使用过的东西。

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

然后我从配置文件中取出index.php

$config['index_page'] = ' ';

我不知道为什么,但当我实现上面的代码时,有些页面运行良好,但其他页面在页面顶部给了我一个302发现的错误,但页面的其余部分确实加载良好,并显示了所有内容。

0
Found
The document has moved here.
Additionally, a 302 Found error was encountered while trying to use an ErrorDocument to handle the request.
HTTP/1.1 200 OK Date: Sat, 25 May 2013 20:50:57 GMT Content-Type: text/html Content-Length: 3696 Connection: keep-alive Server: Apache/2 X-Powered-By: PHP/5.3.13 Set-Cookie: ci_session=a%3A5%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22d2cc22f87cb09c84fbb0600b284633a1%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A14%3A%2268.204.149.255%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A119%3A%22Mozilla%2F5.0+%28Macintosh%3B+Intel+Mac+OS+X+10_8_3%29+AppleWebKit%2F536.29.13+%28KHTML%2C+like+Gecko%29+Version%2F6.0.4+Safari%2F536.29.13%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1369515057%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3B%7Db214b062c5b8bae8b9a05249575ec7e6; expires=Sat, 25-May-2013 22:50:57 GMT; path=/

试试这个,它对我有效。

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

EDIT顺便说一句,我会用你上面.htaccess文件中的每一件东西来代替我所拥有的。