2014-10-06 13 views
5

Masz problemy z mod_rewrite w środowisku Fast-cgi dla CodeIgniter. Mój .htaccess wygląda następująco:Jak usunąć index.php z codeigniter w Fast-cgi

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] 

Ale otrzymałem komunikat o błędzie "Nie podano pliku wejściowego".

Zmieniłem do

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> 

To działa tylko z tym jednym także:

#RewriteRule ^(.*)$ /index.php?/$1 [QSA,L] 

Moim problemem jest to, że nadal mam index.php w adresie URL, gdybym zmienił plik konfiguracyjny application/config/config.php from $ config ['index_page'] = 'index.php'; do $ config ['index_page'] = ''; Mam inny błąd.

Co robię źle?

+3

znalazłem rozwiązanie na application/config/config.php , Zmieniłem $ config ['uri_protocol'] = 'AUTO'; to $ config ['uri_protocol'] = 'REQUEST_URI'; – nandoC

Odpowiedz

0

dodać kod w pliku .htaccess

RewriteEngine on 
RewriteCond $1 !^(index\.php|resources|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

i pliku config.php zmian

$config['index_page'] = 'index.php'; 

do

$config['index_page'] = '';