This guide will show you how to edit the hosts file on your computer in order to point a domain to a specific web server.
A way to view your site before you move the domain to point to the website is through the use of a hosts file. Every computer has a hosts file, and you can edit this file to point a specific domain to your hosting package IP address.
The hosts file basically acts as your computer's own nameserver, and so will map a domain to an IP address just for your own computer.
The host file is located in different locations in different operating systems:
- Windows 10/11:
C:\windows\system32\drivers\etc\* - Linux and other Unix-like operating systems:
/etc - Apple macOS:
/private/etc
Please note that on Windows, you may need to remove the 'Read Only' flag on the hosts file itself.
You can edit this file with any basic text editor (e.g. Notepad). There should be an entry in the file already for 'localhost' and you can copy the required format from this.
e.g.
127.0.0.1 localhostAn example of a completed
hosts file:
81.17.252.145 mysite.com 81.17.252.145 www.mysite.com
The line break between the localhost entries, and entries you add is required
in some operating systems.
Please note that some operating systems may require that the user be an administrator in order to be able to access the hosts file. The easiest way to do this is to run Notepad as Administrator as follows:
- Click the Start button and type notepad
- Right-click on the notepad icon, and click "Run As Administrator" then open the host file as normal.
Further Queries
If you have any queries on this, please contact our Support team - see the following for our contact details:
Comments
0 comments
Article is closed for comments.