Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
删除codeigniter中的index.php_Php_Codeigniter - Fatal编程技术网

删除codeigniter中的index.php

删除codeigniter中的index.php,php,codeigniter,Php,Codeigniter,我知道这是CI中最重复的问题 我正在使用Kubuntu,并做了以下更改 $config['base_url']='http://localhost/cii/'; $config['index_page'] = ''; $config['uri_protocol']= 'REQUEST_URI'; 我将.htaccess文件保存在index.php所在的位置(在根文件夹中),但出现以下错误: 在此服务器上找不到请求的URL/cii/welcome/second。(404错误) 重新启动发动机

我知道这是CI中最重复的问题

我正在使用Kubuntu,并做了以下更改

$config['base_url']='http://localhost/cii/';
$config['index_page'] = '';
$config['uri_protocol']= 'REQUEST_URI';
我将.htaccess文件保存在index.php所在的位置(在根文件夹中),但出现以下错误:

在此服务器上找不到请求的URL/cii/welcome/second。(404错误)


重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
1美元^(索引\.php | images | robots\.txt | css)
重写规则^(.*)$index.php/$1[L]
ErrorDocument 404/index.php

我猜错误是因为您的CI位于子文件夹/cii,但重写规则指向根文件夹。
尝试在第一个块中添加RewriteBase/cii/。

问题可能是由于在apache站点可用配置文件中不允许覆盖任何文档根路径。您需要修改包含AllowOverride None的行,以读取文件中的AllowOverride All(/etc/apache2/sites available/default),使.htaccess文件按预期工作。进行更改后,请重新启动apache一次

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融

如果这不起作用,这里有很多提示:我的目录结构是/www/cii/如果你的base\u url是,那么RewriteBase应该是/cii/,因为它是相对于域的。在行RewriteEngine之后添加行“RewriteBase/cii”-不带引号,因为基文件夹是/cii/,同时将ErrorDocument 404/index.php更新为ErrorDocument 404/cii/index.php
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>