Testing With the Hosts File

Ask | WHMcPanel

Last Update vor 3 Jahren

You may want to view your domain before the DNS changes propagate or you are testing your domain before you point your domain name to us.

 You can achieve this by editing the hosts file on your computer.


To edit your hosts file on either Windows 7 / Vista, Windows 10, Mac OS X and Unix based systems, follow the respective instructions.


Windows 7 and Vista


Browse to 'Start' -> 'All Programs' -> 'Accessories'.


Right mouse click 'Notepad' and select 'Run as Administrator'.

Click 'File' -> 'Open'.


Browse to 'C:' -> 'Windows' -> 'System32' -> 'Drivers' -> 'etc'.


Change the file down file menu from 'Text Documents (*.txt)' to 'All Files (*.*)'.


Select 'hosts' and click 'Open'.


In your hosts file, you may already see a line as such:


127.0.0.1 localhost


What you would need to do is add a line at the end of your hosts file with the server IP that we have provided you (replacing IP ADDRESS shown below) along with your actual domain name. 127.0.0.1 localhost IP ADDRESS www.your-domain.com

Please check that the line you've written does not start with a hash character '#' character because this will not work.


Close Notepad and 'Save' the changes when prompted.

Ensuring that all web browser windows have been closed, If you now visit the domain that you specified, 

You should find that it loads from the specified IP address.


Windows 10


On Windows 10, to edit the hosts file, navigate to 'C:WindowsSystem32Driversetc'. Copy the 'hosts' file onto your Desktop.


Right mouse click the copied file and choose 'Open with.


Select 'Notepad' as the chosen application.


Append your new mappings at the bottom of the document (replacing IP ADDRESS with the server IP address) in this format: IPADDRESS www.your-domain.com

From the Notepad menu, choose 'File' > 'Save As'.


Next, move the copy and paste the file to its original location.

You will be asked if you want to overwrite the file. Choose 'Replace the file in the destination'.


Windows will ask for Administrator permissions. Click 'Continue'.

Ensuring that all web browser windows have been closed, If you now visit the domain that you specified, 

You should find that it loads from the specified IP address.


Mac OS X


Head into your launchpad and search at the top 'terminal'.


Once the Terminal application loads, open the hosts by typing on the Terminal that you have just opened by typing the following followed by enter: 

sudo nano /private/etc/hosts


Type your Mac OS X user account password when prompted and press enter.

Ensuring that all web browser windows have been closed, If you now visit the domain that you specified, 

You should find that it loads from the specified IP address.


Append your new mappings at the bottom of the document (replacing IP ADDRESS with the server IP address). You can navigate the file using the arrow keys. IP ADDRESS www.your-domain.com


Press control-o to save the file. Press enter on the filename prompt, and control-x to exit the editor.



UNIX On Unix-based systems


You can find the hosts file at /etc/hosts.


You will need to open the terminal (on most distributions is located at the following):


'Menu' > 'Applications' > 'Accessories' > 'Terminal'.


Open the hosts by typing on the Terminal that you have just opened by typing: sudo nano /private/etc/hosts


Type your system user account password when prompted.


Append your new mappings at the bottom of the document (replacing IP ADDRESS with the server IP address). 

You can navigate the file using the arrow keys. IP ADDRESS www.your-domain.com

Press control-o to save the file. Press enter on the filename prompt, and control-x to exit the editor.


Ensuring that all web browser windows have been closed, If you now visit the domain that you specified, 

You should find that it loads from the specified IP address.

Was this article helpful?

0 out of 0 liked this article

Still need help? Message Us