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
.htaccess 编码点火器';s";删除index.php文件";CI位于子文件夹内时不工作_.htaccess_Mod Rewrite_Url Rewriting_Codeigniter 2 - Fatal编程技术网

.htaccess 编码点火器';s";删除index.php文件";CI位于子文件夹内时不工作

.htaccess 编码点火器';s";删除index.php文件";CI位于子文件夹内时不工作,.htaccess,mod-rewrite,url-rewriting,codeigniter-2,.htaccess,Mod Rewrite,Url Rewriting,Codeigniter 2,当我编辑.htaccess从url中删除index.php时,我正在使用CI 2.1.4(尝试使用),但它不起作用。我的项目位于子文件夹中: 我已经设置了基本url,从$config['index_page']=''中删除了index.php,并粘贴了准确的代码表单: 尝试了stackoverflow.com的一些解决方案(有些使用RewriteBase),但没有成功。 我该如何解决这个问题呢?我不认为这是因为.htaccess,这对我来说是可行的,也不是因为子文件夹 这是我正在使用的.hta

当我编辑.htaccess从url中删除index.php时,我正在使用CI 2.1.4(尝试使用),但它不起作用。我的项目位于子文件夹中:

我已经设置了基本url,从$config['index_page']=''中删除了index.php,并粘贴了准确的代码表单:

尝试了stackoverflow.com的一些解决方案(有些使用RewriteBase),但没有成功。
我该如何解决这个问题呢?

我不认为这是因为.htaccess,这对我来说是可行的,也不是因为子文件夹

这是我正在使用的.htaccess的一个示例:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^/(index\.php|assets/|humans\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
在基本url或以下url中设置正确的url:

$config['base_url']     = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '')
                  .'://'.$_SERVER['HTTP_HOST'].str_replace('//','/',dirname($_SERVER['SCRIPT_NAME']).'/');
显然:

$config['index_page'] = '';

有了这个,它对我有用…

非常感谢,但它也不起作用。仍然得到“错误404”。即使使用最近提取的CI 2.1.4.Apache配置/etc/httpd/conf/httpd.conf,由于某种原因,AllowOverride也被设置为无。它永远不会加载.htaccess配置。是鬼魂,还是我自己(疯了)改变了它。:)非常感谢@tenshimsm请告知您的httpd.conf文件中发生了哪些更改,以便其他人可以看到。
$config['index_page'] = '';