Index: modules/mappers/mod_rewrite.c
===================================================================
--- modules/mappers/mod_rewrite.c (revision 614276)
+++ modules/mappers/mod_rewrite.c (working copy)
@@ -152,6 +152,7 @@
#define RULEFLAG_NOSUB 1<<12
#define RULEFLAG_STATUS 1<<13
#define RULEFLAG_ESCAPEBACKREF 1<<14
+#define RULEFLAG_ITERATE 1<<15
/* return code of the rewrite rule
* the result may be escaped - or not
@@ -3384,6 +3385,16 @@
}
break;
+ case 'i':
+ case 'I':
+ if (!*key || !strcasecmp(key, "terate")) { /* iterate */
+ cfg->flags |= RULEFLAG_ITERATE;
+ }
+ else {
+ ++error;
+ }
+ break;
+
case 'l':
case 'L':
if (!*key || !strcasecmp(key, "ast")) { /* last */
@@ -4059,10 +4070,20 @@
rc = apply_rewrite_rule(p, ctx);
if (rc) {
- /* Regardless of what we do next, we've found a match. Check to see
- * if any of the request header fields were involved, and add them
- * to the Vary field of the response.
+ /* Regardless of what we do next, we've found a match.
+ * Iterate over the rule as long as it matches,
+ * if the iteration flag has been set.
+ * Don't detroy return code from first match.
*/
+ if (p->flags & RULEFLAG_ITERATE) {
+ while(apply_rewrite_rule(p, ctx)) {
+ }
+ }
+
+ /*
+ * Check to see if any of the request header fields were
+ * involved, and add them to the Vary field of the response.
+ */
if (ctx->vary) {
apr_table_merge(r->headers_out, "Vary", ctx->vary);
}
Index: docs/manual/mod/mod_rewrite.xml
===================================================================
--- docs/manual/mod/mod_rewrite.xml (revision 614276)
+++ docs/manual/mod/mod_rewrite.xml (working copy)
@@ -1338,6 +1338,12 @@
inside the mapped directory to have a handler of
``cgi-script
''.
+
iterate|I
'
+ (iterate while match)last|L
'
(last rule)