Php htaccess重定向到公用和应用程序文件夹

Php htaccess重定向到公用和应用程序文件夹,php,apache,.htaccess,Php,Apache,.htaccess,我有一个MVC项目的目录结构: / | .htaccess | index.php +---application | +---app | | +---controller | | | AppController.class.php | | +---files | | | style.css | | +---model | | \---views | | AllApps.php | |

我有一个MVC项目的目录结构:

/
|   .htaccess
|   index.php
+---application
|   +---app
|   |   +---controller
|   |   |       AppController.class.php
|   |   +---files
|   |   |       style.css
|   |   +---model
|   |   \---views
|   |           AllApps.php
|   |           Main.php
|   \---login
|       +---controller
|       |       LoginController.class.php
|       +---files
|       |       application.js
|       |       login.css
|       |       background.png
|       +---model
|       |       LoginModel.class.php
|       \---views
|               Login.php
\---public
    |   .htaccess
    |   index.php
    +---css
    |       bootstrap.css
    +---js
    |       bootstrap.js
    |       jquery.js
根目录中的htacces文件包含以下内容:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule  (.*)  public/$1 [L]
</IfModule>
其中$1是应用程序文件夹名,$2是文件名

出于测试目的,在index.php文件中打印$\u GET数组并始终打印

Array
(
    [url] => application/login/files/application.js
)
奇怪的是当我评论这句话的时候

RewriteRule  ^((?!__files).)*$  public/$0 [L]
对“文件”中文件的访问是正确的


我认为在重定向到文件文件夹之后,就是文件夹重定向到公用文件夹,但不应该是这样

RewriteEngine on
RewriteCond $1 !^(__files|application) [NC]
RewriteRule  (.*)  public/$1  [L]

RewriteCond $1  ^(__files)*  [NC]
RewriteRule ^__files/([^/]+)/([^/]+)/? application/$1/files/$2 [L,NC]
重要的一点是

1美元!(|文件|应用程序)[NC]


我用*.\u文件*添加了应用程序,似乎在重定向到应用程序目录后,它也会重定向到公用文件夹。

htroot文件夹的访问权限没错,在应用程序文件夹中可以有更多的“应用程序”(文件夹)它包含与登录和应用程序文件夹相同的目录结构,不是静态url。
RewriteRule  ^((?!__files).)*$  public/$0 [L]
RewriteEngine on
RewriteCond $1 !^(__files|application) [NC]
RewriteRule  (.*)  public/$1  [L]

RewriteCond $1  ^(__files)*  [NC]
RewriteRule ^__files/([^/]+)/([^/]+)/? application/$1/files/$2 [L,NC]