Any occurrences of $H are replaced with the portion of the host/domain specification that was not matched by the rule. Any occurrences of $D are replaced by the portion of the host/domain specification that was matched by the rewrite rule. $nH and $nD are variants that preserve the normal $H or $D portion from the nth leftmost part starting counting from 0. Or another way of putting it is that $nH and $nD omit the leftmost n parts (starting counting from 1) of what would normally be a $H or $D, substitution, respectively. In particular, $0H is equivalent to $H and $0D is equivalent to $D.
For example, suppose the address email@example.com matches the rewrite rule
$L substitutes the portion of a domain literal that was not matched by the rewrite rule.