The host file is a simple text file which contains IP addresses. The main objective of the host file to mapping IP address (IPv4 or IPv6) to the host names or we can say that domain IP to your local machine. In this article we will show you how to edit hosts file in window 10.
Remember it will work only in your local machine and didn’t work outside your machine.
In a simple word, when you enter your website URL (www.examle.com) in your browser. First, your computer finds and check the IP address in your hosts file. If your browser finds the IP addresses in your hosts file, it gives the output if not then your computer sends the query to the DNS (Domain Name System) and find the IP addresses of that URL.
Editing your host file is helpful to test your website without going to live in a real server. You can redirect your domain name to your local machine through the hosts file. Without purchase a hosting service. For testing your website in your local machine you need to install Apache server in your computer after that edit hosts file to redirect your local IP addressee to your domain name.
127.0.0.1 localhost 127.0.0.1 www.yourwebsite.com
Modify hosts file in Window 10
Follow the instruction to edit the hosts file in your windows 10 computer.
- First, open your Notepad editor as an administrator.
- In Notepad navigate to file and click open.
- In your computer location bar paste the given address. To open the file location.
- If you cannot see files on that folder then change TXT document to all file option.
- Click on the hosts file to open in the notepad editor.
- At the end of the file add a new line your editor.
- And save the file.
Remember Change example.com to your domain.
Now go to the browser and check the URL you can edit in the hosts file.
www.example.com IP address always serves in your computer hosts file not the DNS name server.