2013-02-01 34 views
1

可能重複:
How to remove 「index.php」 in codeigniter’s path嘗試在笨刪除的index.php

1,創建於笨目錄中的.htaccess文件用下面的代碼

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /ex/ 
    RewriteCond $1 ^(application|system|private|logs) 
    RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L] 
    RewriteCond $1 ^(index\.php|robots\.txt|opensearch\.xml|favicon\.ico|assets|forums) 
    RewriteRule ^(.*)$ - [PT,L] 
    RewriteRule ^(.*)$ index.php/$1 [PT,L] 
    </IfModule> 

2.並將config['index_page']='index.php'更改爲config['index_page']=''

但它不起作用。我的httpd.conf(在/ etc/apache2的/)是空白

回答

0

試試這個在您的.htaccess文件

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 
1

確保您已啓用rewrite_module你的Apache模塊

RewriteEngine On 
RewriteBase /ex/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 
0
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule .* index.php/$0 [PT,L]