A computer uses DNS to convert hostnames like freethought-internet.co.uk into an IP address like 194.110.243.242 or 2a00:b980:2::242. When you browse to a website your computer takes the website address you requested and converts it into the IP that is then used to actually make a connection to the server and request the website data.
Sometimes you may want to access a website hosted on a server before that website address is actually "pointed" at that server in public DNS. For example if you've got a website hosted elsewhere but have developed a new website hosted by Freethought you may want to access that new website on the Freethought server to test it before you put it live for everyone by updating DNS.
You can accomplish this by updating your operating system's "hosts" file to point a domain at a given IP and override the public DNS records.
macOS and Linux
- Open a terminal prompt by searching for "Terminal" either in Spotlight (macOS) or the universal search in Linux (Ubuntu, Fedora etc)
- Type the command sudo nano /etc/hosts
- Add a new line to the bottom of the file with the domain you'd like to setup with a new IP. For example:
194.110.243.194 yourdomain.uk
194.110.243.194 www.yourdomain.uk
- Naturally replace the IP address to that of your new server, and use the domain name you actually want to redirect. Remember to do two lines both with an without the www prefix.
- If your ISP and website support IPv6 you may want to add two additional lines with an IPv6 address also.
- Press Ctrl + O to save your changes.
- Press Ctrl + X to quit the nano text editor.
- Close your terminal prompt.
Microsoft Windows
- Click the start button in the bottom left corner of the window or press the Windows key on your keyboard.
- Searching for "Notepad" by just starting to type once the start menu appears.
- Right click the icon for Notepad and select "Run as administrator"
- Click File > Open and then browse to and open C:\Windows\System32\Drivers\etc\hosts
- Add a new line to the bottom of the file with the domain you'd like to setup with a new IP. For example:
194.110.243.194 yourdomain.uk
194.110.243.194 www.yourdomain.uk
- Naturally replace the IP address to that of your new server, and use the domain name you actually want to redirect. Remember to do two lines both with an without the www prefix.
- If your ISP and website support IPv6 you may want to add two additional lines with an IPv6 address also.
- Press Ctrl + S or browse to File > Save to save your changes.
- Close Notepad.
- Close your terminal prompt.
Once the changes have been made you may have to close and re-open your browser for the changes to start working. Remember once your site has gone live with the new hosting to remove those changes to your hosts file by repeating the steps but removing the lines you added previously. This will avoid any confusion in the future if those changes are left in place.
If you aren't sure what the IP address of your hosting is then contact support or check the hosting control panel which should provide this information.