2011-08-14 97 views
0

我下載了基於代碼點火器的MyClientBase應用程序。安裝後,我查看了MyClientBase的網站,但index.php默認仍然存在。 我試圖使用codeigniter的用戶指南中的提示刪除index.php,但它不起作用。 有沒有解決這個問題的方法?謝謝Codeigniter - 刪除index.php

+0

也許我錯了,但是index.php是CI的引導文件,所以你必須保留它。你所能做的就是用mod_rewrite從URL **中刪除index.php **。 – J0HN

回答

0

我使用下面的.htaccess文件刪除index.php。我不知道哪一個用戶指南規定,但我發現這是完美的工作:

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

#'system' can be replaced if you have renamed your system folder. 
RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ index.php/$1 [L] 

#Checks to see if the user is attempting to access a valid file, 
#such as an image or css document, if this isn't true it sends the 
#request to index.php 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

#This last condition enables access to the images and css folders, and the robots.txt file 
RewriteCond $1 !^(index\.php|(.*)\.swf|images|robots\.txt|css|docs|cache) 
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
    # If we don't have mod_rewrite installed, all 404's 
    # can be sent to index.php, and everything works as normal. 
    ErrorDocument 404 /index.php 
</IfModule> 

而且從你的config.php文件刪除「的index.php」。祝你好運!

+0

嗯...你說沒有Mod_rewrite你會設置ErrorDoc爲index.php你在那裏設置它爲404.php。我錯過了什麼嗎? – BenGC

+0

哎呀,編輯。 – cabaret

+0

嗨感謝您的回覆,我試過了,我找到的所有其他解決方案都無法正常工作。只是FYI,我想要安裝的應用程序是MyClientBase http://www.myclientbase.com/它是基於Code Igniter,但不知怎的Codeigniter關於如何刪除index.php的指令不起作用 – bayu

0

我不知道它是否會有所幫助,但是,我使用它從codeigniter url中刪除我的index.php,創建一個名爲.htaccess的文件並將它放到codeigniter文件夾中。

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.+)$ index.php?/$1 [L]