【发布时间】:2015-08-10 16:16:03
【问题描述】:
我想在 CodeIgniter 中访问没有index.php 的 URL。这是我的Blog 控制器
class Blog extends CI_Controller {
public function index() {
echo 'hello world';
}
public function about() {
echo 'about page';
}
}
现在我可以通过http://localhost/codeigniter/index.php/Blog 访问index,但我需要通过这个URL http://localhost/codeigniter/Blog 访问它。
注意
我从配置文件中删除了 index.php
.htaccess文件
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Environment
Windows、XAMPP、PHP 版本 5.6.3
【问题讨论】:
-
google 一下,“codeginiter 删除 index.php 文件”。
-
编辑您的
.htaccess文件,点击here 了解如何操作。 -
我试过但没用
-
做 2 件事,确保您已将 apache 配置为使用
.htaccess并启用了mod_rewrite.c模块。 -
我已经编辑了我的问题
标签: php codeigniter