Use `replace` in `rewriteRouteTo`

@barnabyc @flahertyb