From: Rich Bowen
Flags can be combined: [R=301,L], [P,QSA],
+[E=VAR:val,L]. This table groups them by purpose, ordered
+by how commonly each is used.
| Flag | +Purpose | +Effect | +Common combos | +
|---|---|---|---|
| Flow Control | |||
| [L] | +Last rule | +Stop processing rules (this pass) | +[R=301,L] [F] [G] | +
| [END] | +Full stop | +Stop all rewrite processing (no re-entry in .htaccess) | +[R=301,END] | +
| [S=N] | +Skip | +Skip next N rules (if/else logic) | ++ |
| [N] | +Next (loop) | +Restart ruleset from the top (caution: loop risk) | ++ |
| [C] | +Chain | +Tie rule to the next; if this fails, skip chained rules | ++ |
| Redirection and Proxying | |||
| [R=code] | +Redirect | +External redirect (default 302). Consider Redirect/RedirectMatch for simple cases | +[R=301,L] [R=302,L] | +
| [P] | +Proxy | +Reverse proxy to target (requires |
+ [P,QSA] | +
| Access Control | |||
| [F] | +Forbidden | +Return 403 (implies [L]) | ++ |
| [G] | +Gone | +Return 410 (implies [L]) | ++ |
| URL / Query String | |||
| [QSA] | +Query string append | +Append original query string to substitution | +[QSA,L] [P,QSA] | +
| [QSD] | +Query string discard | +Drop original query string entirely | +[R=301,QSD,L] | +
| [B] | +Escape backrefs | +Re-encode special chars in backreferences | +[B,PT] | +
| [NE] | +No escape | +Don't escape special chars in output (pass #, ? through) | +[R=301,NE,L] | +
| Metadata and Handlers | |||
| [E] | +Set env var | +Set an environment variable | +[E=VAR:val,L] | +
| [T] | +MIME type | +Force content type | ++ |
| [H] | +Handler | +Force a content handler | ++ |
| [PT] | +Pass through | +Pass result to next handler (needed with Alias/ScriptAlias) | +[PT,L] | +
| Cookie | |||
| [CO] | +Set cookie | +Set an HTTP cookie on the response | +[CO=name:val:.domain,R=302,L] | +
The [B] flag instructs