[RewriteRules] fix: scope of variable not closed