删除codeigniter中的index.php
我知道这是CI中最重复的问题 我正在使用Kubuntu,并做了以下更改删除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错误) 重新启动发动机
$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>