What's new

Welcome to WebForum | Zimbabwe Web Hosting Forum.

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Ask question

Ask questions and get answers from our community

Answer

Answer questions and become an expert on all topics.

Contact us

Get in touch with the site administrator directly.

Forum Group

Join the Forum Whatsapp group for daily updates.
  • Thanks for participating in our community, Discuss and Learn. All Forum members are allowed to create threads and posts. Resources posted here should be CLEAN and SAFE. Do not post “offensive” posts, links, or images. Remain respectful of other members at all times.

How to test your website before changing DNS?

WebForum

Administrator
Staff member
Administrator
Moderator
Business
Joined
May 19, 2021
Messages
98
Reaction score
21
Points
8
Location
Bulawayo
Website
ecowebzim.com
In some cases, when you might be transferring your websites over to Ecowebzim from another provider you may want to test the website functionality without making any changes to the domain’s DNS records, i.e without pointing the site to the new server for everyone else on the internet. You can achieve this by editing the hosts file on your computer.

You need to know the new IP address of your web hosting account or server with Ecowebzim. You can usually find this from the order confirmation email/details.

What is the hosts file?​

The hosts file is used to map hostnames domain names to an IP Address. With the hosts file you can change the IP address that you resolve a given domain name to. This change only affects your own computer without affecting how the domain is resolved worldwide.

The location of the hosts file, depending on the operating system that you are using, is:

  • WindowsSystemRoot > system32 > drivers > etc > hosts
    By default the system root is C:\Windows, so if you are using Windows, your hosts file is most probably: C:\Windows\System32\drivers\etc\hosts)
  • Linux/etc/hosts
  • Mac OS X – /private/etc/hosts

Editing your hosts file​

Windows​

  1. From the Start Menu, search for “Notepad” (Win 8, 10) or navigate to: “All Programs -> Accessories -> Notepad” (Win XP, Vista, 7).
  2. Right-click on Notepad and select “Run As Administrator”.
  3. In Notepad, click “Open” and select the file C:\Windows\System32\Drivers\etc\hosts
  4. At the bottom of the file, add your new IP address followed by the domain name: 11.22.33.44 example.com www.example.com
  5. Save this file overwriting the previous version.

Linux​

  1. Most of the Linux distributions use the hosts file at /etc/hosts. You will need root/sudo access to edit this file. Use your favorite editor to open the file.
  2. To add your domain for testing purposes, in the hosts file, you need to specify what domain points to which IP address. In this example, we will use the IP address 11.22.33.44 and the domain example.com. You will need to add the line: 11.22.33.44 example.com www.example.com
  3. Save the file. All requests for the domain www.example.com and example.com will direct to the specified IP (11.22.33.44).

Mac OSX​

You should be logged in with a user with administrator privileges on your MAC.

  • Open Applications -> Utilities -> Terminal.
  • Edit the hosts file with a command line text editor such as nano by typing the following line in the terminal (the command will require your Mac user’s password): sudo nano /private/etc/hosts
  • Add your changes at the bottom of the file as shown previously.
  • Save the changes with the Control and X key combination.

Testing your Changes​

Pinging the domain name is the easiest way to test if the newly configured IP is working.

To test that the domain is pointed to the correct IP in your hosts file, type the following:

Code:
PING www.example.com (192.168.0.1) 56(84) bytes of data.
64 bytes from www.example.com (192.168.0.1): icmp_req=1 ttl=58 time=1.40 ms
64 bytes from www.example.com (192.168.0.1): icmp_req=2 ttl=58 time=1.31 ms
64 bytes from www.example.com (192.168.0.1): icmp_req=3 ttl=58 time=1.36 ms
64 bytes from www.example.com (192.168.0.1): icmp_req=4 ttl=58 time=1.36 ms
The response should come from the newly configured IP:

In Linux or Mac OS X, you can use ping from the Shell or Terminal respectively. In Windows, you will need to open the command line: Press CTRL + Windows button on the keyboard. In the pop-up window, type cmd and hit enter.
 

Forum statistics

Threads
115
Messages
176
Members
89
Latest member
denzel
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top