41a6c3
Index: modules/mappers/mod_rewrite.h
41a6c3
===================================================================
41a6c3
--- a/modules/mappers/mod_rewrite.h	(revision 1560696)
41a6c3
+++ b/modules/mappers/mod_rewrite.h	(revision 1560697)
41a6c3
@@ -29,6 +29,8 @@
41a6c3
 #include "apr_optional.h"
41a6c3
 #include "httpd.h"
41a6c3
 
41a6c3
+#define REWRITE_REDIRECT_HANDLER_NAME "redirect-handler"
41a6c3
+
41a6c3
 /* rewrite map function prototype */
41a6c3
 typedef char *(rewrite_mapfunc_t)(request_rec *r, char *key);
41a6c3
 
41a6c3
Index: modules/mappers/mod_dir.c
41a6c3
===================================================================
41a6c3
--- a/modules/mappers/mod_dir.c	(revision 1560696)
41a6c3
+++ b/modules/mappers/mod_dir.c	(revision 1560697)
41a6c3
@@ -29,6 +29,7 @@
41a6c3
 #include "http_log.h"
41a6c3
 #include "http_main.h"
41a6c3
 #include "util_script.h"
41a6c3
+#include "mod_rewrite.h"
41a6c3
 
41a6c3
 module AP_MODULE_DECLARE_DATA dir_module;
41a6c3
 
41a6c3
@@ -260,6 +261,11 @@
41a6c3
         return HTTP_MOVED_PERMANENTLY;
41a6c3
     }
41a6c3
 
41a6c3
+    /* we're running between mod_rewrites fixup and its internal redirect handler, step aside */
41a6c3
+    if (!strcmp(r->handler, REWRITE_REDIRECT_HANDLER_NAME)) { 
41a6c3
+        return DECLINED;
41a6c3
+    }
41a6c3
+
41a6c3
     if (d->index_names) {
41a6c3
         names_ptr = (char **)d->index_names->elts;
41a6c3
         num_names = d->index_names->nelts;
41a6c3
Index: modules/mappers/mod_rewrite.c
41a6c3
===================================================================
41a6c3
--- a/modules/mappers/mod_rewrite.c	(revision 1560696)
41a6c3
+++ b/modules/mappers/mod_rewrite.c	(revision 1560697)
41a6c3
@@ -5004,7 +5004,7 @@
41a6c3
             rewritelog((r, 1, dconf->directory, "internal redirect with %s "
41a6c3
                         "[INTERNAL REDIRECT]", r->filename));
41a6c3
             r->filename = apr_pstrcat(r->pool, "redirect:", r->filename, NULL);
41a6c3
-            r->handler = "redirect-handler";
41a6c3
+            r->handler = REWRITE_REDIRECT_HANDLER_NAME;
41a6c3
             return OK;
41a6c3
         }
41a6c3
     }
41a6c3
@@ -5050,7 +5050,7 @@
41a6c3
  */
41a6c3
 static int handler_redirect(request_rec *r)
41a6c3
 {
41a6c3
-    if (strcmp(r->handler, "redirect-handler")) {
41a6c3
+    if (strcmp(r->handler, REWRITE_REDIRECT_HANDLER_NAME)) {
41a6c3
         return DECLINED;
41a6c3
     }
41a6c3