Map certain ports to URLs via hosts file or DNS resolver I use SSH tunnelling extensively to gain access to remote machines that are behind a firewall. So to access a development server I use something like http://localhost:8888 which is forwarded to port 80 on a remote host.

Is there a way to simplify my setup with custom domains? For instance, I want to be able to type in http://remote.dev and actually be accessing http://localhost:8888?
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.