0

I want to set up a machine for testing a website before launching it. Some of the tests require logic in parsing the current host.

I want to be able to test it in my browser but i can only access it through the localhost.

I want to know how to make my browser resolve my domain to 127.0.0.1:80. (Also I don't want my DNS record to point to my test machine, this should be a local test only).

Also, is there a way to make all sub-domains of my domain access 127.0.0.1:80 as well?

Extra Info -- OS: Windows 7 Browser: Chrome Web Server: Tomcat 7

Thank You.

EDIT --- The solution was to add a few lines to the host file:

127.0.0.1 example.com

etc.

1 Answers1

1

You're looking for the hosts file. It's more than likely what points localhost to 127.0.0.1 on your computer.

You can find it at C:\Windows\System32\drivers\etc\hosts on Windows. Or /etc/hosts on most Linux systems, if you're interested.

Steven V
  • 16,357
  • 3
  • 63
  • 76
  • Thanks! Any way to add all sub-domains without explicitly typing them out? – sorasystemsllc Aug 11 '13 at 19:58
  • I think you're stuck typing out every domain. It's a pretty "dumb" system, so no wildcards are allowed. According to [another SO question](http://stackoverflow.com/questions/138162/wildcards-in-a-hosts-file) there are DNS proxies you could install which would allow you to accomplish this. – Steven V Aug 11 '13 at 19:59
  • A DNS proxy sounds a little heavy weight. I ended up just typing out about 100 sub-domains which should be sufficient for the tests. thanks again – sorasystemsllc Aug 11 '13 at 20:03