Map certain ports to URLs via hosts file or DNS resolver
DNS and hosts are only for domain mapping of IP addresses. Ports aren't part of a domain, and according to this post, it cannot be done in the way you're asking. There is an alternative solution mentioned there, but things can get messy when modifying firewall tables. Essentially what you have to do is redirect 127.0.0.1:8888 to a remote server (you'll have to know the IP address of the server, and it'll have to be unique). That being said, it is possible, but may not be worth the effort or potential consequences.