First, open Notepad as an administrator by right clicking it and selecting Run as Administrator :. Finally, paste the hosts file location from above into the File name: field and hit Open :. And that's you, inside the hosts file and ready to edit it! If you want to learn how to use the hosts file, read on Each hostname you want to define should be on one line and there should be a new line for each hostname. The syntax is fairly straight forward, first write the name of the host e.
IP address you want the hostname to point to. Then, after a space or tab , add the hostname. For example, the below line would make home. Say you also wanted to add the host Has this page answered your question? Yes Get Help Report a Problem. Expand your skills. Get new features first. Was this information helpful?
Yes No. Thank you! Any more feedback? The more you tell us the more we can help. Can you help us improve? Resolved my issue. Clear instructions. Easy to follow. No jargon. Pictures helped. Didn't match my screen. Incorrect instructions. Too technical. Not enough information. Not enough pictures. Any additional feedback? While the internet is only about 30 years old, in many ways the hosts file is a relic of its not so ancient past. In most cases you probably won't need to update your hosts file on Windows.
But knowing where it is and how it works can be helpful if:. In this article we'll cover what a hosts file is , how to edit it on Windows , and we'll go over some neat tricks you can do with it. Back in the early days of the internet, before it was widespread, computers used a hosts file to map long, hard to remember IP addresses with much shorter, easier to remember hostnames. That way, instead of having to remember a long IP address, all you had to do was visit localhost.
As the internet grew, so did the length and complexity of the hosts files. Also, each hosts file only worked for the computer it was on, and keeping them in sync with the changes in hostnames and IP addresses became a huge pain. For example, imagine that you have two computers, A and B. Their hosts files contain this mapping for google. So everyone on computer B is stuck without Google until someone updates the hosts file. When that person does update the hosts file, they add another entry to handle Google with the www subdomain.
Now everyone on computer B is taken to the correct website whether they visit google. And everyone on computer A can only visit google. If you're thinking that someone should have just made a central repository to map all IP addresses with all hostnames, that's exactly what happened. Early on, a central hosts file was manually maintained and shared by the Stanford Research Institute. This system lead to the invention of domains and top level domains like. In the end, the humble hosts file and innovators like Elizabeth J.
Feinler lead to the invention of the Domain Name System still in use today. First, open Notepad as an administrator by pressing the Windows key, typing in "notepad", and clicking "Run as administrator":. You won't be able to see any files in this directory because they aren't text documents. To change the file type, click on the dropdown in the bottom right of the Open menu and click on "All Files":. Note that everything is commented out with characters, meaning that nothing is actually being read from the hosts file.
Modern versions of Windows include a sort of DNS system already, so if you visit localhost it'll automatically redirect you to If you're doing some local development and are having problems with localhost, you can just remove the comments from your hosts file:. Then, open PowerShell by pressing the Windows key, searching for "powershell", and clicking "Run as Administrator":.
After that, you should be able to visit localhost in your browser and see whatever you're hacking on. If you're still having issues, try closing your browser completely, then open a new browser window and try again.
Even though hosts files have fallen out of favor with newer systems like DNS, they still work for legacy reasons. And hackers have definitely taken advantage of this in the past.
0コメント