来自documentation :
<VirtualHost *:80>
ServerName www.mycook.com
DocumentRoot /webapps/mycook/public
<Directory /webapps/mycook/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
那么为什么是下面这行呢?
Options -MultiViews
我粗略地理解,how MultiViews有效,坦率地说,我不明白为什么有人会使用它。尽管如此,我不明白为什么 Passenger 配置指南认为在站点配置中显式禁用该选项如此重要。
谁能透露一下情况吗?
最佳答案
我不熟悉 Rails,但一般来说,启用 MultiViews 在某些情况下可能会导致有趣的行为 - 最常见的是,当输入不正确的 URL 时,它最终可能会提供页面,而不是返回 404 .
Here是一篇关于多 View 另一个微妙的可能问题的博客文章。
This GoDaddy 博客文章指出了另一个有问题的后果:
Script files are of particular concern. Say you have an old version of a script.pl file that you copy to script.pl.bak for backup purposes. A request for script.pl.bak will still be interpreted by Apache as a Perl script, causing the old version of your code to be executed! One can imagine other instances where a script file may be executed unintentionally because of this behavior by Apache.
底线,多 View 对于静态 HTML 页面的集合来说很好,但在重写 URL 的环境中并不是一件好事。
关于ruby-on-rails - 为什么 Passenger/mod_rails 文档要求我显式禁用多 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4774547/