Re: mod_rewrite NS flag buggy ?
André Malo wrote:
> * Stephen Collyer <ns_news@netspinner.co.uk> wrote:
>
>
>>What I'm expecting is that if the first rule rewrites to
>>/bill, then mod_rewrite will start a new subrequest with the
>>uri /bill and eventually rerun the rules above and match on
>>the 2nd RewriteCond; however, given that I've specified NS,
>>then the 2nd RewriteRule should be ignored, leaving the rewrite
>>to /bill in effect.
>
>
> Nope. mod_rewrite issues a new internal redirect (in .htaccess) which is a
> different thing.
OK, I'm confused. I thought that an internal redirect (as generated by,
say, the mod_perl internal_redirect() function) *was* a sub-request. e.g.
on page 554 of the Stein/MacEachern mod_perl book, it says "A special case
of a sub-request is an internal redirect, ..." and then goes on to describe
the C subrequest API, one of which is ap_internal_redirect().
So it's not clear to me why an internal redirect doesn't trigger NS.
>>Can anyone make a sensible comment on this ? I'm not sure
>>if I'm mis-identifying [INTERNAL REQUEST] with a sub-request
>>i.e. maybe mod_rewrite doesn't count sub-requests that it
>>generated itself as true sub-requests ? If so, it seems to me
>>that it'd be impossible to eliminate a large class of infinite loops.
>
>
> The typical way is to check for REDIRECT_ variables, e.g. REDIRECT_STATUS.
> (an internal redirect causes most of the original variables to be prefixed
> with REDIRECT_).
OK, this sounds useful.
Thanks
Steve Collyer
|