Codeigniter 3删除index.php问题 [英] Codeigniter 3 Remove index.php Problems
问题描述
我有一个项目,我开发了一个客户端的codeigniter 2.1.4现在,他坚持迁移到codeigniter 3 DEV版本。我知道这不是一个好的意见,但...
我的问题是,我不能从URL中删除index.php。
I have a little project that i developed for a client in codeigniter 2.1.4 and now, he insists to migrate to codeigniter 3 DEV version. I know that's not a good ideea but... My problem is that i can't remove the index.php from the url.
这是我的.htaccess文件:
This is my .htaccess file :
Options +FollowSymLinks
RewriteEngine on
# Send request via index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
我已经从config.php文件中删除了index.php
没有运气
我重新安装了LAMP服务器(我在Ubuntu 12.04'),重新配置了我在我的本地服务器上有其他项目在Codeigniter 2.1.4和Laravel 4开发,他们工作很好,但这个一个它杀了我。
谢谢!
I have removed the index.php from the config.php file
No luck
I reinstalled the LAMP server (i'm on Ubuntu 12.04'), reconfigured
I have other projects on my local server developed on Codeigniter 2.1.4 and Laravel 4 and they work just fine but this one it's killing me.
Thank you!
推荐答案
我这样做:
在项目的根文件夹中创建.htaccess,内容如下:
Created the .htaccess in the root folder of the project with the content:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)
RewriteRule ^(.*)$ index.php?$1 [L]
config.php我修改了这一行。
Then, in the config.php i modified this line.
From:
$config['url_suffix'] = 'index.php';
To:
$config['url_suffix'] = '';
这篇关于Codeigniter 3删除index.php问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!