Add single-rule wildcard rewrite function
Fix wrong var
Return rewritten rules
Add multi-rule wildcard rewrite function