Apache codeigniter重命名index.php文件/codeigniter中的多个应用程序

Apache codeigniter重命名index.php文件/codeigniter中的多个应用程序,apache,codeigniter,codeigniter-3,Apache,Codeigniter,Codeigniter 3,我的codeigniter中有两个应用程序(版本3) 第一个应用(比如主应用)目录是apps/main,由根目录中的index.php处理 第二个app(比如说api app)目录是apps/api,由根目录中的api.php处理 .htaccess文件 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^api/(.*)$ api.php/$

我的codeigniter中有两个应用程序(版本3) 第一个应用(比如主应用)目录是apps/main,由根目录中的index.php处理 第二个app(比如说api app)目录是apps/api,由根目录中的api.php处理

.htaccess文件

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^api/(.*)$ api.php/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
我有这些重写规则,这样我就可以在没有index.php或api.php的情况下访问任何URL

主应用程序可以使用此重写规则正常工作,但第二个应用程序(API应用程序)不工作

当我尝试https://mydomain/api.php/url-slug 它工作得很好(没有重写规则),但当我尝试时https://mydomain/api/url-slug 它显示了404错误。我不知道是配置错误还是.htaccess文件错误

/apps/api/config/config.php

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

为api/url段塞部分使用路由如何?我也尝试过,但不起作用。这似乎是重写规则的问题。