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


how to remove index.php in .htaccess file in codeiginator

嗨,我是codeigniter的新手。当我访问url名称"http://abc/php/newseller/home/sign"时,它给出404错误。但当我访问http://abc/php/newseller/index.php/home/sign时,它会给出页面。我想删除"index.php",我的网站应该使用这个url "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 的相同问题

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

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

更改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]