How do I re-map a hostname to another?

Assuming that oneheckofalongdomainname.com is a live website, they probably have a static IP address. Ping oneheckofalongdomainname.com to resolve the DNS entry to an IP. Take that IP, and edit /etc/hosts to map a.com to the resulting IP.

Hope this helps!


You can do so, but this would require a name server and cannot be done by an /etc/hosts entry. You need to forward a CNAME to another CNAME. If it is just temporary you might be ok with resolving the IP address for the hostname you wish to forward and put this into /etc/hosts or - if it is a web page you wish to forward, you could set up Apache accordingly. But for all other services (nfs, rsync, ftp) you will probably not be able to do it without a (dummy) name server.

See also here


Depending on what is on the other end a CNAME won't work either. If it is a website for example it could be using host headers which means it uses the domain name you request on in order to serve the correct website.

One way you could get around this would be to setup a local web server with a redirect to the long named domain. You would then point the short domain in /etc/hosts at the local address 127.0.0.1