apache / .htaccess symlink loop
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?!
RewriteCond %{REQUEST_URI} !^/site/assets/sym
精彩评论