Added handling for trailing '/' on URLs without query parameters