重写规则为什么要options +followsymlinks

keywords:Apache Rewrite Rule、伪静态、Apache 重写规则
Web服务器的Apache安装编译成功mod_rewrite编译成模块,但当我在网站根目录下放了一个.htaccess配置文件,却得到了一个500内部服务器出错。

我打开我的.htaccess配置文件,发现文件头有 Options +FollowSymlinks

上网查了一下“在 某些服务器配置中,mod_rewrite要求有followsymlinks,否则会显示500内部服务器错误。

[In some (or all?) server configurations, mod_rewrite requires followsymlinks to be enabled, or it will crater with a 500-Server Error.]

在任何情况下,只要您没有指定FollowSymLinks的选项(即Options FollowSymLinks),或者指定了SymLinksIfOwnerMatch选项,Apache将不得不调用额外的系统函数来检查符号链接。每次针对文件名的请求都将触发一次检查。

如果你没有使用followsymlinks规则而网站访问正常,说明你的服务器配置已经默认调用followsymlinks的重写规则,你无需再为你的htaccess文件定义了。但在有些服务器500 Server Error之后的错误日志中提示需要定义SymLinks使得rewrite重写规则起作用。

If your mod_rewrite code works without the options +followsymlinks directive, that means that your server configuration file has enabled them already, and you won't need that directive in your .htaccess files.

The requirement for enabling followsymlinks is not well-defined. The only way I learned about it was because I got a 500-Server Error the first time I ever enabled mod_rewrite, and the error log entry said something to the effect of, "You must enable SymLinks for this to work."

另一个问题是 RewriteBase / 注释到底起什么作用,去掉了,伪静态照样有效。

注:本文仅是经验记录,实践的、革着四棵棕榈树。内侧两棵棕榈树一样偏高,外两头两棵可能刚种植不久,显得略矮。它们的棕叶聚生于顶,发散得近乎松弛。命的应用,但无科学的理论、有待进一步的学习。

标签:,


随机文章:

整个 Yo2 上的相关文章:

相关文章

最近阅读过此文章的网友:

友好推广 :

留下您的意见

XHTML: 您可以使用这些标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>