无法删除的index.php在WAMP与codeigniter网址 [英] Unable to remove index.php in WAMP with Codeigniter URL

查看:144
本文介绍了无法删除的index.php在WAMP与codeigniter网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除在URL中的index.php,但它不工作。 这是我做的:

I want to remove the index.php in the URL but it doesn't work. Here's what I did:

  1. 我启用我的Apache的rewrite_module然后重新启动服务器
  2. 我编辑的.htaccess在我的codeigniter文件夹。我这个根据文档中的例子添加。

  1. I enable the rewrite_module in my Apache then restart server
  2. I edit the .htaccess in my codeigniter folder. I add this according to the example in the documentation.

RewriteEngine叙述在

RewriteEngine On

的RewriteCond%{} REQUEST_FILENAME!-f

RewriteCond %{REQUEST_FILENAME} !-f

的RewriteCond%{} REQUEST_FILENAME!-d

RewriteCond %{REQUEST_FILENAME} !-d

重写规则^(。*)$的index.php / $ 1 [L]

RewriteRule ^(.*)$ index.php/$1 [L]

然后,我也是在应用程序/配置中删除的index.php

Then I also remove the index.php in app/config

然后,我创建一个简单的控制器:

Then I create a simple controller:

class Users extends CI_Controller {

    public function __construct() {
        parent::__construct();
    }

    public function index() {
        echo "hello world";
    }

}

当我访问这个网址:

http://localhost/order_menu/users

我得到这个错误:

I got this error:

Not Found

The requested URL /order_menu/users was not found on this server.

您可以帮我这个?

推荐答案

当你使用WAMP确保您已启用Apache模块rewrite_module重启服务器

Removing index.php in codeigniter on wamp apache server!

When your using wamp make sure you have enabled Apache Modules "rewrite_module" restart server

试试这个htaccess的项目的主目录

Try this htaccess in main directory of project

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

然后进入应用程序/配置/ config.php文件

Then go to application/config/config.php

查找 $配置['index_page'] ='的index.php';

然后让空白的index.php

And then make index.php blank

替换为 $配置['index_page'] ='';

您可能需要配置您的路线

You may need to configure your routes

Cl 3: HTTP://www.$c$cigniter.com/ user_guide /一般/ routing.html

CI2: HTTP://www.$c$cigniter.com/ userguide2 /一般/ routing.html

这篇关于无法删除的index.php在WAMP与codeigniter网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆