Ensure that we always have two capture groups in nginx redirect regex expressions
We sometimes had one and mostly had two capture groups. Now we always have two capture groups and thus can always use $2 for the redirect target.
Fixes #6144 (closed)