mod_rewrite chain flag

Just wondering how many following statements does the chain flag chain up to. Is it just the one immediately right after? And if I want to chain more, I just append the same flag to the end of the second rule?

Thanks.

EDIT: Also using the same space, I want to ask a question about the N flag as well. Does it restart all the rules from the start of the htaccess file or does it only redo the rule which the flag is applied to?

kefeso,

[QUOTE=kefeso"]
Just wondering how many following statements does the chain flag chain up to. Is it just the one immediately right after? And if I want to chain more, I just append the same flag to the end of the second rule?
[/quote]

That would be as many statements as are chained.

Of interest to you SHOULD be the Skip command as it is also “block” directive (acting as a GoTo directive to … skip … a specified number of RewriteRule (block statements):

‘skip|S=num’ (skip next rule(s))
This flag forces the rewriting engine to skip the next num rules in sequence, if the current rule matches. Use this to make pseudo if-then-else constructs: The last rule of the then-clause becomes skip=N, where N is the number of rules in the else-clause. (This is not the same as the ‘chain|C’ flag!)

ALL! That’s is the NORMAL operation of mod_rewrite except that you are forcing the IMMEDIATE restart rather than continuing through the remaining rewrite statements before the restart.

Regards,

DK