After making a change to your domain in the Customer Zone – for example a server move during a platform switch – it can take a while before the change takes effect. Using your computer’s hosts file, you can preview the new location before that happens.
Use this method with care – it’s best suited to more advanced users. This guide covers editing the hosts file on Windows. The same feature exists on Mac and Linux, so the principle is the same – only the file’s location differs.
Editing the hosts file
Open File Explorer and navigate to “C:\Windows\System32\drivers\etc”. The folder contains several files, but you only need the file named “hosts”. By default you won’t have the permissions needed to edit it, but there are two ways around that:
- Copy the file to your desktop, make your changes, then replace the original file with your edited version. Keep a copy of the original file.
- Right-click the file, choose “Properties”, go to the “Security” tab, and give your user full permissions.
When you open the file, it looks something like this:
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line... # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost
Say your domain yourdomain.com is parked, with the IP addresses 194.9.94.85 and 194.9.94.86 currently associated with it. How long it takes for a new value to take effect depends on that record’s TTL and on the DNS servers across the internet.
Now say you want to switch the domain yourdomain.com to “Website with Loopia” and point it to the server s506.loopia.se, which has the IP address 93.188.2.52.
Say you’ve also uploaded content via FTP and want to preview it right away. Add the following line to your hosts file:
93.188.2.52 yourdomain.com
Once you visit the site, your computer talks directly to that web server and shows the content you’ve uploaded via FTP.
Remember to change the hosts file back to its original state once you’ve got the result you wanted.