How to access a namebased website without a DNS record

Monday, August 31, 2009 posted by admin

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

192.168.0.100        www.mydomain.com

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

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 availalble for local dns resolving.

Be Sociable, Share!



5 Responses to “How to access a namebased website without a DNS record”

  1. TonyT says:

    Terrific piece of information to know. I had to use it to check on a web site before DNS servers were updated and it worked great. Very slick. Thanks.

  2. ThaGeek says:

    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.

  3. daliusm says:

    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 :))

  4. Fred says:

    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

  5. Chad says:

    for mac, just enter in terminal;

    sudo nano /etc/hosts

    use “control + x’ to exit ans save

Leave a Reply