Properly encode path segments when reverse routing