htaccess,mod_rewrite,从URL中删除部分

我想访问domain.com/api/(.*)而不是domain.com/public/api/(.*)

目录结构:

 domain.com __folder1 __folder2 __public ____api ______.htaccess2 ____afolder1 ____afolder2 ____index.html __folder3 __file1 __file2 __.htaccess1 

.htaccess1

 RewriteEngine on SetEnv APPLICATION_ENV production RewriteRule ^$ /public/ [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/public/ RewriteCond %{REQUEST_URI} !^/api/ RewriteRule ^(.*)$ /public/$1 [L] 

.htaccess2

 RewriteEngine on SetEnv APPLICATION_ENV production RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L] 

我尝试了不同的组合,我来到这个最简单的组合。 我试了Alias,把api文件夹放在根目录下等等

要提到公用文件夹中的index.html首先在domain.com中加载,公用文件夹是文档根。