Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top