Take a look at [RFC 5.2.4](https://tools.ietf.org/html/rfc3986) and work on [removing dot segments](https://tools.ietf.org/html/rfc3986#section-5.2.4).