如何删除codeigniter中.htaccess文件中的index.php

时间:2013-12-03 12:30:11

标签: php codeigniter

您好,我是codeigniter的新手。 当我访问网址名称"http://abc/php/newseller/home/sign"时,它会给出404错误。但是当我访问http://abc/php/newseller/index.php/home/sign时,它会给出页面。我想删除“index.php”,我的网站应该使用此网址运行"http://localhost/php/newseller/home/sign" 为此我试过.htaccess文件

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 

并删除application / config / config.php

中的index.php
$config['index_page'] = '';

但得到404的相同问题

2 个答案:

答案 0 :(得分:0)

您可以尝试在config.php中更改此方法

$config['uri_protocol'] = 'AUTO';

答案 1 :(得分:0)

更改config.php文件中的设置

$config['index_page'] = 'index.php';
$config['index_page'] = '';  

请删除index.php文件并设置基本URL,它将正常工作。

请尝试使用此htaccess代码。

RewriteEngine On
RewriteBase /Project Folder Name
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|scripts|styles|vendor|robots\.txt)
#RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]