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

In occasions when performing a migration, as well as in other circumstances, you will need to check the web content hosted with us, but keeping the server that your domain name is currently pointing to. This allows you to see that everything is working as expected before pointing your current domain to the SW Hosting server.

Here's how to do this for each operating system.

Windows

  1. Locate the Notepad icon.
  2. Right click on the icon and select Run as administrator.
  3. Go to the File > Open menu and edit the following file on your computer:`C:Windows System32 "C:\System32".
  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, go to menu File > Save.

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

For your domain to point to the new server for real, you will have to modify the domain nameserver or DNS zone (A record).

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

Mac

  1. Open the Terminal, do a search on Spotlight to quickly locate it.
  2. Enter the following command to edit the hosts file:sudo nano /private/etc/hosts.
  3. You will need to enter the administrator password. Remember that the password characters will not be displayed as 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 access it through the IP you have specified in the file (81.25.123.45) instead of the one the domain actually points to. These changes only affect the computer on which you have modified the "hosts" file.

For your domain to point to the new server for real, you will have to modify the domain nameserver or DNS zone (A record).

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

Linux

  1. Open the Terminal.
  2. Enter the following command to edit the hosts file: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.
  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 access it through the IP you have specified in the file (81.25.123.45) instead of the one the domain actually points to. These changes only affect the computer on which you have modified the "hosts" file.

For your domain to point to the new server for real, you will have to modify the domain nameserver (DNS servers) or the DNS zone (A record).

Remember that you will have to delete this new line that you have 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.