Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Right now I access my dev. server as localhost.

How do I change it so that I can type "myservername" and it will work as an "alias" for localhost?


share|improve this question

Add an entry to your hosts file such as:     myservername.mydomain.local myservername

Where the file is located depends on your OS but all files are the same.

share|improve this answer
This is definitely the answer to the question, but I don't generally like aliasing things to "localhost" so much as I do the external IP of the machine, unless there's a security issue with it running on the external interface. Just personal habit, I suppose. – Matt Simmons Jun 25 '09 at 2:39
this sort-of works. the pages load, but they load slowly. plus, not all the images/css files load. It seems random which ones do load. But, if I navigate to the files directly like myservername/images/anything.png they all load instantly...wierd... – Chris Krinler Jun 25 '09 at 2:40
I'm trying to get it so that my host machine and virtual pc can load all the images and css files using the same urls. I've been playing around with the host files on both. It seems I can't change the virtual pc's host file to set the host's ip as localhost. That would be the easiest. – Chris Krinler Jun 25 '09 at 2:42
Using the Public, Private IP is acceptable also. If I was locking things down, I would certify that only the actual IP was being used instead of the loopback and certify that the loopback was also not answering requests for services. Having multiple entries in a host file is acceptable. This file is checked before any network name resolution is performed such as WINS, DNS, NetBios or your preferred protocol. – Jason B Shrout Jun 25 '09 at 20:16

Add an entry for "myservername" in your hosts file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.