httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Kay <>
Subject Re: [users@httpd] Internal Recursion with mod_rewrite
Date Tue, 30 Jun 2009 18:14:28 GMT

----- Original Message ----

> I'm embedding Gallery2 in PmWiki, and trying to get rewrite rules to work...

Ok, I think I understand what's going on (after installing a local copy of apache, etc to
let me push up the debug levels...I didn't know httpd could crash so easily!):

>      RewriteCond %{THE_REQUEST} /Main/Gallery/([^?]+)(\?.|\ .) 
>      RewriteRule .   /Main/Gallery?g2_path=%1   [QSA,L] 

So, after this, /Main/Gallery/test1/ gets mapped to /Main/Gallery?g2_path=test1/, then (as
per the fine print in the 'last rule' section of the mod_rewrite documentation), "the RewriteRule
generates an internal redirect (which frequently occurs when rewriting in a per-directory
context), this will reinject the request and will cause processing to be repeated starting
from the first RewriteRule."

So, /Main/Gallery gets re-injected (hmm...) and matches /Main/Gallery/ again.  And again.
 And Again.

What's the proper way to avoid this?

Is adding another RewriteCond %{THE_REQUEST} !/Main/Gallery the canonical way to go?  Or is
there some way to turn off the re-injection?


--Peter Kay


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message