忽略不存在的文件的 htaccess 规则?



我有以下站点结构:

http://www.mysite.com/index.php --> main entry for Zend
http://www.mysite.com/.htaccess --> the htaccess file
http://www.mysite.com/models/index.php --> a NON-zend subsite.

我的问题是,因为我们允许其他几个网站提供服务http://www.mysite.com/models/index.php,我们的日志中有几个错误,例如:

 [error] File does not exist: /mnt/models/files/assets/seo/file.gif

换句话说,其他站点正在调用models/index.php,但由于包含它的方式,其他不存在的路径也被调用。例如:

http://www.mysite.com/models/files/assets/seo/file.gif

我想在htaccess文件中包含一条规则,该规则将阻止所有不存在的文件报告给ZEND。

在ZEND htaccess文件中,我有:

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

我如何在htaccess文件中包含一些将忽略模型/

中不存在的文件的内容

最简单的修复方法可能是忽略对models/的任何请求。在现有规则之上添加此行:

RewriteCond %{REQUEST_URI} !(^/models)

最新更新