fix path rewrite ending with `/`