ACT-1641 - rewriting url might corrupt hostname

Hi, thanks for merging #60, but meanwhile I found a few more places where the url gets rewritten in a similar way, breaking our hostname.