5
在CodeIgniter的Fast-cgi環境中遇到mod_rewrite問題。我的.htaccess看起來像這樣:如何在Fast-cgi中從codeigniter中刪除index.php
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\\.php|images|css|js|robots\\.txt|favicon\\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
但是我得到一個錯誤'沒有指定輸入文件'。
我改
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L]
RewriteCond $1 !^(index\.php|images|robots\.txt)
#RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
只用這一個也可以工作:
#RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
我的問題是,我仍然有index.php文件的URL,如果我改變配置文件從$ config ['index_page'] ='index.php'的application/config/config.php;到$ config ['index_page'] ='';我有一個不同的錯誤。
我做錯了什麼?
我發現了的application/config/config.php文件中的解決方案,我改變了$ config ['uri_protocol'] ='AUTO';到$ config ['uri_protocol'] ='REQUEST_URI'; – nandoC 2014-10-06 16:39:15