我一直在努力解决这个问题,并尝试了谷歌提供的一切。我的网站在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=/
答案 0 :(得分:0)
试试这个,它对我有用。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
EDIT
顺便说一句,我会用你上面.htaccess文件中的所有内容替换我所拥有的内容。