Guides and tutorials

Hundreds of tutorials and step by step guides carefully written by our support team.

Modify 'hosts' file on Windows, Mac and Linux

Sometimes, performing a migration as well as in other circumstances, you will need to consult the web content hosted with us, but maintaining the server to which your domain currently points. This allows you to see that everything is working as you expect before pointing your current domain to the SW Hosting server.

We tell you how to do this with each operating system.

Windows

  1. Locate the Notepad icon.
  2. Right click on the icon and select Execute as administrator.
  3. Access the menu **File ** > Open, and edit the following file on your computer:C:\Windows\System32\drivers\etc\hosts
  4. Add a line with the IP of the new server followed by the domain, for example:81.25.123.45 swhosting.com www.swhosting.com
  5. Save the changes, access the menu File > Save.

Now, when you access "swhosting.com", you will do it through the IP you have indicated in the file (81.25.123.45) instead of the one to which the domain really points. These changes only affect the computer on which you have modified the "hosts" file.

In order for your domain to point to the new server in a real way, you must modify the "nameserver" (DNS servers) of the domain or the DNS zone (register A).

Remember that later you will have to delete this new line that you just added.

Mac

  1. Open the Terminal, perform a search on Spotlight to quickly locate it.
  2. Enter the following command to edit the file hosts:sudo nano/private/etc/hosts
  3. You must enter the administrator password. Remember that the password characters will not be displayed while you type. Once entered, press Enter on your keyboard.
  4. Scroll to the end of the file with the arrow on your keyboard, and add a line with the IP of the new server followed by the domain, for example: 81.25.123.45 swhosting.com www.swhosting.com
  5. Save the changes by pressing: Ctrl + O (letter, not number)
  6. Close the file by pressing: Ctrl + X
  7. Finally, enter the following command to reload the DNS cache:dscacheutil -flushchache

Now, when you access "swhosting.com", you will do it through the IP you have indicated in the file (81.25.123.45) instead of the one to which the domain really points. These changes only affect the computer on which you have modified the "hosts" file.

In order for your domain to point to the new server in a real way, you must modify the "nameserver" (DNS servers) of the domain or the DNS zone (register A).

Remember that later you will have to delete this new line that you just added.

Linux

  1. Open the Terminal.
  2. Enter the following command to edit the file hosts: sudo nano/etc/hosts
  3. Scroll to the end of the file with the arrow on your keyboard, and add a line with the IP of the new server followed by the domain, for example: 81.25.123.45 swhosting.com www.swhosting.com
  4. Save the changes by pressing: Ctrl + O (letter, not number)
  5. Close the file by pressing: Ctrl + X

Now, when you access "swhosting.com", you will do it through the IP you have indicated in the file (81.25.123.45) instead of the one to which the domain really points. These changes only affect the computer on which you have modified the "hosts" file.

In order for your domain to point to the new server in a real way, you must modify the "nameserver" (DNS servers) of the domain or the DNS zone (register A).

Remember that later you will have to delete this new line that you just added.

More than 2000 m² of own facilities and Data Centers in Spain
Your privacy is important for us
We use our own cookies for the proper functioning of the site. In addition, third-party cookies are used for analytical purposes only. This information is not associated with any person so that personal identifying data is not stored, but is only information that is collected to identify the session, with the aim of facilitating the analysis of the website. You can change your preferences at any time by entering this website again. For more information about our cookie policy you can visit our Cookies. You can press the "Accept and close" button to give us your consent or you can access more detailed information and manage cookies.
More than 2000 m² of own facilities and Data Centers in Spain
Your privacy is important for us
We use our own cookies for the proper functioning of the site. In addition, third-party cookies are used for analytical purposes only. This information is not associated with any person so that personal identifying data is not stored, but is only information that is collected to identify the session, with the aim of facilitating the analysis of the website. You can change your preferences at any time by entering this website again. For more information about our cookie policy you can visit our Cookies. You can press the "Accept and close" button to give us your consent or you can access more detailed information and manage cookies.