*8996* Porting stats fixes

I think this will break for URL's with ports: http://example.com:1234/foo will leave :1234/foo. This might cause issues in dev installs.