Php Apache重写不包括资产目录

Php Apache重写不包括资产目录,php,apache,mod-rewrite,url-routing,Php,Apache,Mod Rewrite,Url Routing,我正在编写一个迷你MVC应用程序。应用程序架构: 行动/ 模板/ 场地/ 应用程序/ 风格/ 图像/ 剧本/ 到目前为止,我有一个控制器工作正常,接收所有请求。但是,浏览器中没有正确呈现javascript文件;当我尝试在浏览器中加载文件时,发现404未找到 以下是vhost文件中的当前目录配置: <Directory "/path/to/apps/ecatalogue"> DirectoryIndex index.php RewriteEngine On RewriteBase /

我正在编写一个迷你MVC应用程序。应用程序架构:

行动/ 模板/ 场地/ 应用程序/ 风格/ 图像/ 剧本/

到目前为止,我有一个控制器工作正常,接收所有请求。但是,浏览器中没有正确呈现javascript文件;当我尝试在浏览器中加载文件时,发现404未找到

以下是vhost文件中的当前目录配置:

<Directory "/path/to/apps/ecatalogue">
DirectoryIndex index.php
RewriteEngine On
RewriteBase /apps/ecatalogue
RewriteRule ^scripts/(.*) - [NC,L] <--- Rule not working
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [NC,L,QSA]
</Directory>

DirectoryIndex.php
重新启动发动机
RewriteBase/apps/ecatalogue

重写规则^scripts/(.*)-[NC,L]我在这里切换了一些东西——这是基于我运行的几乎所有MVC应用程序所使用的重写规则。它来自Zend框架文档中的一些建议

DirectoryIndex index.php

RewriteEngine On
RewriteBase /apps/ecatalogue

# If it's a file/directory/symlink, serve it.
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^.*$ - [NC,L]

# Otherwise let's go MVC
RewriteRule ^.*$ index.php [NC,L]

嗨,阿吉,非常感谢你的回复。把它放到一个新的vhost配置中。当我尝试访问JS文件时,它不再给我404错误,而是给我设置的通用MVC错误页面。