apply rewrite rules for "z" links