Instead, you can use the hosts file to make connecting to other devices on your local network much faster. For example, if your router is at Otherwise your browser might not recognize. Fortunately there are a whole lot of valid TLDs nowadays.
Again, the one downside to this method is that it only works on once device. You'd have to update the hosts files on your other devices to enable the same shortcuts. And that should be just about everything you need to know about the hosts file on Windows And a lot of this knowledge should carry over to Linux and macOS. Did you find this helpful? Are there any other hosts file tricks you know?
Let me know over on Twitter. If you read this far, tweet to the author to show them you care. Tweet a thanks. Learn to code for free. Get started. Forum Donate. Kris Koishigawa.
But knowing where it is and how it works can be helpful if: you're having trouble with local development you suspect malware has tampered with the hosts file you want a quick and simple way to block some websites or if you want to set up some helpful shortcuts to internal IP addresses 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. What's a hosts file anyway?
For example, here's a line you'll find in many hosts files on Windows, Linux, and macOs: Why hosts files fell out of favor The hosts files system worked well for the early internet, but there were a few major problems.
As you can imagine, hosts files would get complicated, fast. The solution 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. How to edit a hosts file on Windows To edit a hosts file on Windows 10, you'll need to open it as an administrator.
To change the file type, click on the dropdown in the bottom right of the Open menu and click on "All Files": You'll see a file named hosts.
Double click on that file to open it. Then, you'll see a hosts file similar to this: Copyright c Microsoft Corp. This file contains the mappings of IP addresses to host names. Each entry should be kept on an individual line. The IP address should be placed in the first column followed by the corresponding host name. You will see options appear on the bottom portion of the Start Page. Select Run as administrator. Note: Performing this action may cause Windows User Account Control to prompt you with a warning, or if you are logged in as another user, a request for the Administrator password.
This step is necessary to modify system files such as the hosts file. On Windows 98 and Windows 95, the order may be the hostname , IP address. To locate Mac hosts files location: Navigate to the Terminal application.
Replace Replace domain. Additional domains, subdomains, or addon domains such as www. To open the terminal: Go to Menu. Select Applications. Choose Accessories. Select Terminal. The hosts file contains some comments lines starting with the symbol and some default hostname mappings e. Append your new mappings underneath the default ones.
You can navigate the file using the arrow keys. So if your browser isn't going where it should be, a good place to look first is the hosts file. You need to access the Windows folder on your root drive which is usually on 'the 'C drive' and the folder is usually named 'Windows'. Once in the Windows folder you'll need to open the 'System32' folder, then the 'drivers' folder, followed by the 'etc' folder. Once you've located the hosts file open it using Notepad. One thing to note: be aware that your windows installation might be in a different folder then the one mentioned above.
If you double click the file and it asks which program to open this file with, select Notepad and make sure you leave the 'Always use the selected program to open this kind of file' box unchecked. Once you've opened the file you should see a description with some examples at the top of the file and then depending on whether your hosts file has had entries added to it some numbers will be on the bottom.
Note that any line starting with the symbol is a comment and therefore will not have any effect in other words it is harmless. For most users the only uncommented line i.
This just refers to your own computer; Any other line that doesn't start with a can be deleted or if you're afraid to completely delete a line then just comment out the line using the symbol which will disable the entry.
0コメント