How to access a name based website without a DNS record

If you want to access a name-based website that you created e.g. in ISPConfig before the DNS records are set up, edit the hosts file on your workstation computer and add a line like this:

192.168.0.100        www.mydomain.com mydomain.com

Edit hosts file on macOS X

To edit the hosts file on a computer running macOS X, use this command:

sudo nano /etc/hosts

Replace the IP address with the IP of your server and www.mydomain.com with the domain name of the website.

Windows 10 hosts File location

The hosts file on Linux and MAC systems is /etc/hosts, on Windows systems the hosts file is:

C:\Windows\system32\drivers\etc\hosts

The above trick also works if you want to run a website in your internal network (intranet) without having a DNS server available for local DNS resolving.

5 thoughts on “How to access a name based website without a DNS record”

  1. If you are on Vista or Windows 7, you may need to either disable UAC or run notepad as administrator, then open the hosts file otherwise you will be unable to save it.

    Reply
  2. This way is not good. If you are behind of transparent proxy, hosts file modification is not effective. So problem exists.

    I even cannot comment here from office :))

    Reply
  3. For MacOSX, the way to edit the /etc/hosts file is possible with the following command :
    sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts

    Reply

Leave a Comment

*