我已经为此苦苦挣扎了一段时间,并尝试了谷歌提供的一切。我的网站使用 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 found 错误,但是页面的其余部分确实可以正常加载并显示所有内容。
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=/