我想删除URL中的index.php,但它不起作用 . 这是我做的:
-
我在Apache中启用rewrite_module然后重启服务器
-
我编辑了codeigniter文件夹中的.htaccess . 我根据文档中的示例添加了这个 .
RewriteEngine On
RewriteCond%! - f
RewriteCond%!-d
RewriteRule ^( . *)$ index.php / $ 1 [L]
-
然后我也删除了app / config中的index.php
-
然后我创建一个简单的控制器:
class Users extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
echo "hello world";
}
}
当我访问此URL时:
http://localhost/order_menu/users
我收到了这个错误:
Not Found
The requested URL /order_menu/users was not found on this server.
你能帮我解决这个问题吗?
1 回答
删除wamp apache服务器上的codeigniter中的index.php!
使用wamp时确保已启用Apache Modules“rewrite_module”重启服务器
第二
在项目的主目录中试试这个htaccess
然后转到application / config / config.php
然后使index.php为空
您可能需要配置路线
CI3:http://www.codeigniter.com/user_guide/general/routing.html
CI2:http://www.codeigniter.com/userguide2/general/routing.html