1

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?

Thanks

2 Answers 2

5

Add an entry to your hosts file such as:

127.0.0.1     myservername.mydomain.local myservername

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

4
  • 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. Jun 25, 2009 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, 2009 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, 2009 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. Jun 25, 2009 at 20:16
1

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

You must log in to answer this question.