Temporary access with an undelegated domain
On our computer, we can edit the hosts file to force access to a site as if it were hosted at an IP address different from the one its DNS uses.
This is especially useful when migrating our site to another server, so we can verify access before pointing the domain to it.
This file indicates which IP address to look up for a given domain, bypassing the traditional method of finding its location (DNS servers).
If you don't remember the IP address or your username, please write to us so we can send you the details again.
What is the hosts file, and where is it located?
The hosts file is an ordinary text file. However, its simple nature is somewhat "hidden" because it doesn't have the typical .txt extension.
The location of '*hosts*' in Windows is as follows (note: if we have Linux or MacOS, see the relevant instructions below):
C:\Windows\System32\drivers\etc\hosts
Although, as we mentioned, this is a simple text file, because it is located inside a system folder, we can only edit it with administrator privileges.
This is easy: simply launch the "Notepad" app, but right-click it to find the following option:
A prompt will appear asking us to allow Notepad to edit protected system files. It will look something like this:
Of course, we need to click the "Yes" button.
Once that's done, the text editor will appear on screen just as we know it (except that it will allow us to edit and save the hosts file). In Notepad, we'll go to Open and find the hosts file at the previously mentioned path (C:\Windows\System32\drivers\etc\hosts).
Note: when we get to the 'etc' folder, we won't see anything. This is because none of the files in that folder has the .txt extension.
To see the hosts file, we'll click where indicated in the screenshot below and select "All files (.)":
Voilá!
At the end of the file, add the IP address of the server where your website is hosted, followed by the domain. Ask us for the destination IP if you don't have it: don't use the IP address of the DNS servers or another service.
192.0.2.10 example.com www.example.comThe IP address 192.0.2.10 and the domain example.com are examples only. Replace them with your hosting IP address and your actual domain, without https:// or any paths. Include the www version if your site uses it. The following screenshot shows where to enter the line; don't copy its IP address.
When we're done, we'll save the changes and close Notepad.
Done. Our operating system will now not look up our website's IP address via DNS as usual. Instead, it will already know the IP address of the server hosting our site, whether or not DNS propagation is complete.
How do I edit the hosts file on Linux?
On Linux, we can use any text editor we like:
sudo nano /etc/hostsOnce the file is open, we'll add our site's IP address and domain, just as shown in the screenshot above for Windows.
How do I edit the hosts file on Mac?
To edit the hosts file on MacOS, we'll open Launchpad and search for the "Terminal" app. In the Terminal window, we'll enter the following code:
sudo nano /private/etc/hostsWe'll enter our Administrator password, and the hosts file will open on Mac right away.
Thanks to this edit, as explained, our operating system won't rely on Internet DNS to find our site's server. Instead, it will already know where it is, without having to wait for DNS propagation to finish. This means we'll see our site right away and/or be able to work on it to get it ready.
What to check and how to finish the test
Save the file without adding the
.txtextension. If you still see the previous server, close and reopen your browser; contact us if it still uses the previous resolution.The change only affects this computer. It doesn't change public DNS or what other people or external services see, such as payment gateway notifications.
To test HTTPS, the destination needs a valid certificate for your domain. If a certificate warning appears, check with support before entering any login details.
When you're done, delete only the line you added. This will make your computer look up the public resolution again, so you can verify the actual DNS change.
To coordinate the full transfer, see the site migration guide.