Accessing a site without changing the nameserver through the hosts file

Tutorials Domains | hosts file | windows | hosting
In this tutorial we will follow the steps necessary to access the site hosted on a server without the need to change the nameservers, using the hosts file of the operating system
by Ana RednicViews 108Updated now 1 yearPublished 24/01/2018

Introduction

  • The hosts file of the operating system provides the ability to access hosted sites on a server without the need for a DNS server or to change domain nameservers. It can also be used for development purposes if we do not own the domain, but we have a hosting.

Requirements

  • In order to use the hosts file of the operating system, we will need the IP on which the domain we want to access is hosted  and the location of the hosts file.
    The hosts file is located at the following locations depending on the operating system used:
    c:\Windows\System32\Drivers\etc\hosts - Windows
    /private/etc/hosts - Mac OS X
    /etc/hosts - Linux

Steps

  • In this tutorial we will use the Windows operating system as an example. To edit the file, we will start the Notepad text editing application (with administrative privileges) or any other text editor (we recommend Notepad ++) and open the hosts file by clicking File in the top bar, then Open. In this case, we will open the file in the path c: \ Windows \ System32 \ Drivers \ etc \ hosts (the letter c: \ the disk may differ depending on the location of the operating system installation). We will ensure that Notepad has the All Files (*. *) option on the right of the File Name field to view all file types.

  • Once the file has been opened, we will add the following lines:
    SERVER_IP_ADDRESS    domainexample.xx 
    SERVER_IP_ADDRESS    www.domainexample.xx 
  • As an example, we will use the hostico.net domain hosted on the server with IP 89.44.200.147. In this case, we will add the following lines to the hosts file and save the changes made:
    89.44.200.147     hostico.net   
    89.44.200.147     www.hostico.net   
  • The above mentioned IP and domain are just an example. You will have to use the domain and IP associated with your hosting account. You can find the IP addres of your webhosting account in the email sent by us, uppon activating your services.

hosts file

  • Several domains and subdomains can be added to the hosts file leading to different servers (IPs), the functionality being the same.
  • In the next step, we will open a browser and test whether the domain is being loaded from the server that we want. It is recommended to clear the browser cache before you try.

Similar Articles

1
How to set nameservers in the ROTLD panelTutorials Domains | nameservers update | rotld
This article will describe the steps required to set or update nameservers on a domain registered with ROTLD
by Ana RednicViews 268Updated now 18 daysPublished 25/10/2018
1
Enable DNSSEC in ROTLDTutorials Domains | dnssec | domain | rotld
This tutorial will describe the steps required to enable DNSSEC on a .ro domain in the ROTLD panel
by Ana RednicViews 224Updated now 18 daysPublished 25/10/2018
Creating a website in 3 simple stepsTutorials General | website | sitebuilder | sitepad
In this article we explain every step required to have an online site in just a few minutes
by Mark DohiViews 179Updated now 18 daysPublished 07/10/2020
Activate remote MySQL from Hostico client accountTutorials Commercial | mysql | remote mysql | client account | hosting | vps
This article describes the steps required to add an IP to the MySQL remote list
by Mark DohiViews 173Published now 5 monthsPublished 19/04/2022
Changing the PHP version in cPanel on VPS hosting packages through MultiPHP ManagerTutorials cPanel | multiphp manager | cpanel | php | version | vps
In this article we will present the required steps to change the PHP version in a cPanel account through MultiPHP Manager
by Ana RednicViews 129Updated now 18 daysPublished 25/10/2018