Apache Mod Rewrite

Rewrite rule structure:

RewriteRule pattern target [Flag1,Flag2,Flag3]

Pattern

Target

Flags

Flags are included in square brackets at the end of the rule, and multiple flags are separated by commas.

Flag Description
L Stop the rewriting process immediately and don’t apply any more rules.
NC No Case. Use of the NC flag causes the RewriteRule to be matched in a case-insensitive manner. That is, it doesn’t care whether letters appear as upper-case or lower-case in the matched URI.
R Redirect. R[=code] or redirect[=code]. Example: R=302

Examples:

# Redirect everything to a new domain and/or path:
RewriteRule ^(.*)$ https://mydomain.com/path/ [R=302,L]

# Redirect everything at a specific path to a new domain and/or path:
RewriteRule ^/some/path/$ https://mydomain.com/path/ [R=302,L]