There was a problem loading the comments.

Testing With the Hosts File

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
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'. alt text
Right mouse click 'Notepad' and select 'Run as Administrator'. alt text
Click 'File' -> 'Open'. alt text
Browse to 'C:' -> 'Windows' -> 'System32' -> 'Drivers' -> 'etc'. alt text
Change the file down file menu from 'Text Documents (*.txt)' to 'All Files (.)'. alt text
Select 'hosts' and click 'Open'. alt text
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 IPADDRESS shown below) along with your actual domain name. 127.0.0.1 localhost IPADDRESS www.your-domain.com alt text 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. alt text 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. alt text
Right mouse click the copied file and choose 'Open with. alt text
Select 'Notepad' as the chosen application. alt text
Append your new mappings at the bottom of the document (replacing IPADDRESS with the server IP address) in this format: IPADDRESS www.your-domain.com alt text From the Notepad menu, choose 'File' > 'Save'.
Next, move the copy and paste the file to its original location. alt text
You will be asked if you want to overwrite the file. Choose 'Replace the file in the destination'. alt text
Windows will ask for Administrator permissions. Click 'Continue'. alt text 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'. alt text
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 alt text
Type your Mac OS X user account password when prompted and press enter. alt text 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 IPADDRESS with the server IP address). You can navigate the file using the arrow keys. IPADDRESS www.your-domain.com alt text
Press control-o to save the file. Press enter on the filename prompt, and control-x to exit the editor. alt text

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 IPADDRESS with the server IP address). You can navigate the file using the arrow keys. IPADDRESS www.your-domain.com alt text 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.

Share via
Did you find this article useful?  

Related Articles

© HostPresto!