I'm working on a project where I'd like to redirect all traffic from a domain name to a specific port at a specific IP address with the settings on my local machine. The hosts file almost does what I want, except for the port specific part.
For example, in the hosts file, I can type
and then when I type 'example.com' into my browser, it redirects to the server at localhost.
I'd like to be able to write
to have example.com redirect to port 123 on localhost.
Is there a good way to do this?