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 Answers2

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.

MikeyB
  • 39,291
  • 10
  • 105
  • 189
Jason B Shrout
  • 394
  • 2
  • 9
  • 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 02: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 http://myservername/images/anything.png they all load instantly...wierd... –  Jun 25 '09 at 02: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. –  Jun 25 '09 at 02: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
1

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

Sean Earp
  • 7,227
  • 3
  • 36
  • 38