Java Mailing List Archive

http://www.apache-httpd.com/

Home » users.httpd »

Re: [users@httpd] Internal Recursion with mod_rewrite

Peter Kay

2009-06-30

Replies: Find Java Web Hosting

Author LoginPost Reply

----- 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?

Thanks,

--Peter Kay


   

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@(protected)
 "  from the digest: users-digest-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.