trail rewrite