apache / .htaccess 符号链接循环
我们使用符号链接在多个站点之间共享各种资源,并且最近注意到我们的 apache 错误日志包含以下大量内容;
由于可能的配置错误,请求超出了 10 个内部重定向的限制。
这是 .htaccess 的全部内容;
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site/assets/sym/$1 [L]
apache手册警告了[L]标签的限制;
因此,如果您在这些上下文之一中使用 RewriteRule 指令,请务必采取明确的步骤来避免规则循环,而不是仅依靠 [L] 标志来终止一系列操作的规则,如下所示。 ( http://httpd.apache.org/docs/current/rewrite/ flags.html#flag_l )
我想知道是否需要添加 [NS] 标签或可能另一个 RewriteRule 之类的东西? - 非常感谢任何帮助!
附:日志中的更多详细信息对我来说更强调这是一个符号问题?....
[Fri Sep 30 10:38:59 2011] [debug] core.c(3083): [client someIP] r->uri = /site/assets/sym/sym/sym/sym/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/template/css/default.css
[Fri Sep 30 10:38:59 2011] [error] [client someIP] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
pps。它正在查找的文件不存在,所以也许问题需要改写为“如何修改此 htaccess 文件以在退出之前仅尝试一次符号链接目录” - 这更简洁,是吧?!
We're using symlinks to share various assets across multiple sites, and have recently noticed our apache error log containing lots of the following;
Request exceeded the limit of 10 internal redirects due to probable configuration error.
Here's the .htaccess in its entirety;
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site/assets/sym/$1 [L]
The apache manual warns of the limits of the [L] tag;
It is therefore important, if you are using RewriteRule directives in one of these contexts, >that you take explicit steps to avoid rules looping, and not count solely on the [L] flag to >terminate execution of a series of rules, as shown below. ( http://httpd.apache.org/docs/current/rewrite/flags.html#flag_l )
I'm wondering if something like the addition of an [NS] tag, or possibly another RewriteRule is necessary? - Any help much appreciated!
ps. further detail from the log rather underlines for me that this is a sym problem?....
[Fri Sep 30 10:38:59 2011] [debug] core.c(3083): [client someIP] r->uri = /site/assets/sym/sym/sym/sym/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/sym/template/css/default.css
[Fri Sep 30 10:38:59 2011] [debug] core.c(3089): [client someIP] redirected from r->uri = /site/assets/template/css/default.css
[Fri Sep 30 10:38:59 2011] [error] [client someIP] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
pps. the file it's looking for doesn't exist, so perhaps the question needs to be rephrased to something like 'how can I modify this htaccess file to only try the symlinked directoy once before quitting' - that's a bit more concise, huh?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)