If your new website is being developed on our servers while your old site using the same domain name is still live, to preview the new site you need to edit a text file on your computer.
The hosts file controls where your web browser looks for your site and you need to edit this to redirect domain requests. The method used to do this depends on your operating system, see below.
Note that these changes may also affect sending and receiving email if it uses the same domain name as the website, in which case immediately switch back the changes after previewing your site to restore your email sending/receiving.
You need to add the following lines to your hosts file (replacing domain.com with your site domain):
213.129.84.87 www.domain.com
213.129.84.87 domain.com
To switch back to seeing your live site, you can delete these lines or add # at the start of each line, eg:
# 213.129.84.87 www.domain.com
# 213.129.84.87 domain.com
Operating system
Windows 10, Windows 8, Windows 7 and Windows Vista
Windows 8, Windows 7 and Windows Vista use User Account Control (UAC), so Notepad must be run as Administrator.
For Windows 10 and Windows 8
- Press the Windows key.
- Type Notepad in the search field.
- In the search right click Notepad and select Run as administrator.
- In Notepad, open the following file:
c:\Windows\System32\Drivers\etc\hosts
to see this file in the Notepad file browser you will need to switch filetype from Text Documents (*.txt) to All Files (*.*) - Make the necessary changes to the hosts file.
- Click File -> Save to save your changes.
For Windows 7 and Windows Vista
- For Click Start -> All Programs -> Accessories.
- Right click Notepad and select Run as administrator.
- Click Continue on the “Windows needs your permission” UAC window.
- When Notepad opens Click File -> Open.
- In the filename field type:
C:\Windows\System32\Drivers\etc\hosts
to see this file in the Notepad file browser you will need to switch filetype from Text Documents (*.txt) to All Files (*.*) - Click Open.
- Make the necessary changes to the hosts file.
- Click File -> Save to save your changes.
Windows NT/2000/XP
- Click Start -> All Programs -> Accessories -> Notepad.
- Click File -> Open.
- In the filename field type:
C:\Windows\System32\Drivers\etc\hosts - Click Open.
- Make the necessary changes to the hosts file.
- Click File -> Save to save your changes.
Linux
1. Open a terminal window.
2. Open the hosts file in a text editor (you can substitute any text editor):
sudo nano /etc/hosts
3. Enter your password.
4. Make the necessary changes to the hosts file.
5. Press control-X (hold control and hit X), then answer y when asked if you want to save your changes.
Mac OS X 10.0 – 10.5
1. Open /Applications/Utilities/NetInfo Manager.
2. To allow editing the NetInfo database, click the padlock in the lower left corner of the window.
3. Enter your password and click OK.
4. In the second column of the browser view, select the node named machines. You will see entries for -DHCP-, broadcasthost, and localhost in the third column.
5. Select the localhost item in the third column.
6. Choose Duplicate from the Edit menu (the quickest way to create a new entry is to duplicate an existing one). A confirmation alert appears.
7. Click Duplicate. A new entry called localhost copy appears, and its properties are shown below the browser view.
8. Double-click the value of the ip_address property and enter the IP address of the other computer.
9. Double-click the value of the name property and enter the hostname you want for the other computer.
10. Click the serves property and choose Delete from the Edit menu.
11. Choose Save from the File menu. A confirmation alert appears.
12. Click Update this copy.
13. Repeat steps 6 through 12 for each additional host entry you wish to add.
14. Choose Quit from the NetInfo Manager menu. You do not need to restart the computer.
Mac OS X 10.6 – 10.11
1. Open Applications > Utilities > Terminal.
2. Backup the hosts file by typing (or pasting) the following in the Terminal window:
sudo cp /private/etc/hosts ~/Documents/hosts-backup
then return, type your user password if prompted.
3. Open the hosts file by typing (or pasting) the following in the Terminal window:
sudo nano /private/etc/hosts
then return, type your user password if prompted.
4. Edit the hosts file. The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 – local host). Append your new mappings underneath the default mappings.
5. Save the hosts file by pressing Control+x and answering y.
6. Make your changes take effect by flushing the DNS cache with the following command(s) in Terminal, followed bt return:
for 10.6 (Snow Leopard)
dscacheutil -flushcache
for 10.7 (Lion) – 10.8 (Mountain Lion)
sudo killall -HUP mDNSResponder
for 10.9 (Mavericks)
dscacheutil -flushcache;sudo killall -HUP mDNSResponder
for 10.10 (Yosemite) up to 10.10.3
sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches
for 10.10.4 and above
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say DNS cache flushed
7. New mappings should now take effect but you may need to restart your browser.