【发布时间】:2015-09-15 01:22:25
【问题描述】:
我想删除 URL 中的 index.php,但它不起作用。 这是我所做的:
- 我在我的 Apache 中启用了 rewrite_module,然后重新启动服务器
-
我在我的 codeigniter 文件夹中编辑 .htaccess。我根据文档中的示例添加了这个。
重写引擎开启
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
重写规则 ^(.*)$ index.php/$1 [L]
那我也把app/config里面的index.php去掉
-
然后我创建一个简单的控制器:
class Users extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { echo "hello world"; } }
当我访问这个网址时:
http://localhost/order_menu/users
我收到了这个错误:
Not Found
The requested URL /order_menu/users was not found on this server.
你能帮我解决这个问题吗?
【问题讨论】:
-
你在使用 wamp 服务器吗?你有没有在 config/routes.php 中设置一些路由
-
我正在使用 wamserver。在我的路线中,我有默认的 CodeIgniter
-
你在 wamp 中启用了 rewrite mod 吗?
标签: php .htaccess codeigniter