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.
来自:
$config['url_suffix'] = 'index.php';
致:
$config['url_suffix'] = '';
这篇关于Codeigniter 3 删除 index.php 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!