apache / .htaccess 符号链接循环

发布于 2024-12-09 04:38:41 字数 2761 浏览 4 评论 0原文

我们使用符号链接在多个站点之间共享各种资源,并且最近注意到我们的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流年已逝 2024-12-16 04:38:41
RewriteCond %{REQUEST_URI} !^/site/assets/sym
RewriteCond %{REQUEST_URI} !^/site/assets/sym
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文