Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
删除CI ubuntu 12.04中的index.php文件_Php_.htaccess_Codeigniter_Mod Rewrite - Fatal编程技术网

删除CI ubuntu 12.04中的index.php文件

删除CI ubuntu 12.04中的index.php文件,php,.htaccess,codeigniter,mod-rewrite,Php,.htaccess,Codeigniter,Mod Rewrite,我想从CI中的文件路径中删除index.php文件。我正在使用ubuntu 12.04。我尝试了几乎所有的论坛结果,但没有成功 我将CI文件夹放置在此路径 http://localhost/xxx/CI/ 我已经启用了apache重写模块 sudo a2enmod rewrite Module rewrite already enabled 我的conf.php文件中也有这个 $config['uri_protocol'] = 'AUTO'; $config['base_url'] = 'h

我想从CI中的文件路径中删除index.php文件。我正在使用ubuntu 12.04。我尝试了几乎所有的论坛结果,但没有成功

我将CI文件夹放置在此路径

http://localhost/xxx/CI/
我已经启用了apache重写模块

sudo a2enmod rewrite
Module rewrite already enabled
我的conf.php文件中也有这个

$config['uri_protocol'] = 'AUTO';
$config['base_url'] = 'http://localhost/xxx/CI/'; 
$config['index_page'] = '';
$config['index_url'] = '';
我的.htaccess文件中有这个

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
.htaccess文件位于此路径

http://localhost/xxx/CI/.htaccess
它也是通过apache启用的

/etc/apache2/sites-available/default
AllowOverride All
当我像这样访问文件时,会出现此错误

 http://localhost/xxx/CI/login/
 404 Error
 The requested URL /xxx/CI/login/ was not found on this server.
任何帮助都将不胜感激


谢谢

您的htaccess文件中有此代码吗

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
请尝试以下内容:

RewriteEngine On
RewriteBase /xxx/CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder/index.php/$1 [L]
并选中必须启用apache的“重写模块”

配置中的索引页面应为空
$config['index_page']=''

尝试使用下面的
.htaccess
文件:

RewriteEngine On
RewriteBase /xxx/CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]
然后,将
uri\u协议
AUTO
更改为
PATH\u INFO

$config['uri_protocol']='PATH_INFO';
如果开始将所有内容重新路由到默认控制器,则将其更改为
ORIG\u PATH\u INFO

$config['uri_protocol']='ORIG_PATH_INFO';
其他信息

在文件中插入以下行:

Options -Multiviews +FollowSymLinks
AllowOverride All

我试过了,但是没有成功,是的,apache重写模块也被启用了,这也是真的$config['index.php']='';我把它放在RewriteBase/var/www/xxx/CI/i将RewriteBase改成了这个xxx/CI/但仍然是同一个问题,我甚至重新启动了apache。我尝试了,但没有成功,我一行一行地尝试了这两行,但什么都没有发生RewriteRule^(.*$/var/www/xxx/CI/index.php/$1[L]/RewriteRule^(.*$/xxx/CI/index.php/$1[L]你有404个错误吗?你的
.htaccess
文件在哪里?是的,迈克,我收到404错误。我的.htaccess文件位于此路径。我非常感谢您的回复,我完全按照您所说的做了,但仍然无法正常工作,并给我404错误。首先,我将uri_协议更改为PATH_INFO,它显示404错误,然后我将其更改为ORIG_PATH_INFO,再次显示404错误:(我在前面的文件/etc/apache2/sites available/default Options index MultiViews FollowSymLinks AllowOverride我对此所做的所有更改根据您的消息仍然是404错误,我也重新启动了apache。这是一个实际的配置文件吗?您是否尝试将其放入
httpd.conf
文件中?现在404错误已被删除,但无论我访问哪个页面,它都只显示相同的视图。+1我认为问题在于选项。很好。URI路径不应该像问题中那样传递到
index.php