2011-08-14 166 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]