Right-click the hosts file and select Open with. Select Notepad from the choice of programs displayed for you. If you do not see Notepad in the list, scroll down to the bottom of the screen and click the hyperlink Look for another app on this PC.
Enter the IP address and the host name for each host you want to add to this file. The graphic below shows an example of what the entry would look like. Do not use the address and server name in the example. It is only used for demonstration purposes. Make sure there is no pound symbol at the beginning of the entry or else it will be considered a comment and will be ignored by the system. On the menu, click File, Save. Click Yes and then save it to another location, like desktop or Documents folder.
Delete the. Close Notepad. Navigate to the location where you saved the file. You may notice that even though you told Windows not to use a file extension it ignored your instruction and saved the file with a. Do not forget the s at the end. You will see the following prompt that if you change a file name extension, the file might become unstable.
Click Yes. Paste the file in the etc folder. I could not find the issue when it works ok on w7 but doesn't on win8, thank you!!! This worked for me after upgrading to windows 8. Jason Aller 3, 28 28 gold badges 39 39 silver badges 37 37 bronze badges. Kharmachanic Kharmachanic 19 1 1 bronze badge. In the question Jon Mulligan states that, "I'm not connected via any proxies". EricLaw EricLaw Good answer, IE protected mode was the issue here.
Those posts make for some interesting reading though. Links have been fixed. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. However, these tend to deal with a specific case, and once whatever mistake the OP made is found out, the discussion is over. If you don't happen to have made the same error, such a discussion isn't very useful.
So I thought it would be more helpful to have a general protocol for resolving all hosts-related issues that would cover all cases. Changes to hosts should take effect immediately, but Windows caches name resolution data so for some time the old records may be used. To drop the old data. To check if it works, use assuming you have an ipv4 entry in your hosts for www.
NB: nslookup does not look at the hosts file. Sample entries, using Unicode control pictures to indicate control characters. Don't copy and paste these into your hosts file! If you copied and pasted hosts entries from somewhere, you may end up with multiple spaces. In theory hosts supports multiple spaces separating the two columns, but it's another thing to try if nothing else works.
To be on the safe side, make sure all lines in your hosts file either use tabs or spaces, not both. There is a registry key specifying the location of the hosts file. Supposedly, Windows doesn't actually support putting the hosts file in other locations, but you might want to check. The key is:. Sometimes there are issues with permissions on the file, the file attributes, and similar things. To recreate the file with default permissions:. The local Users account must be able to read the hosts file.
To make sure in Windows 7 :. If you have a proxy configured, it may bypass the hosts file. The solution is to not use the proxy, or configure it to not do this. If everything is blank and "Automatically detect settings" is checked, you aren't using a proxy.
Then add your exceptions to the Exceptions text box. This is not necessary for the hosts file to work , but it may help in your case if something is configured strangely. If you are using a. Windows somehow does not append its workgroup or localdomain.
Windows hosts file seems to have a line or host limit. If you have more than characters on a line or more than 8 hosts entries for an IP create a new line. Please add checking file permissions. I found that even though I had Local Admin rights to the computer and thus to hosts.
I was experiencing the same issue, hosts file entries being ignored. I tried everything in this and many other threads with no luck. I figured I'd post what worked for me in case someone else comes across this.
Note: simply opening the hosts file and deleting the content, verifying that it was 0kb and re-adding it did not work. I suspect a permissions issue on the file. I think as part of its security it prevents malware or viruses diverting you to alternative sites. Took mysite of the list of trusted sites and it no longer checks and "corrects" my hosts file diversion. This can happen if there is, say, only one entry in the file, and when you ignore the comment-out text.
One problem missed in the discussion above is unqualified names names that do not include a period in the hosts file. Your network settings might kick in at that point and automatically add your own domain to the end of an unqualified domain. Consequently the name might not resolve, or worse yet, resolve to a completely different machine. The ip is pingable as you can see yourself. Works for me Is there some firewall on your windows machine? There is DrWeb Firewall that blocks changing the hosts, but I turned that lock off and managed to edit the file.
Show 2 more comments. Active Oldest Votes. Improve this answer. I found that I had to use a tab to separate the IP address and Domain name [ Spaces didn't work.
What an obscure problem, I had the exact same issue, ended up copying the example line included in the host file, pasting it on a new line and changing the values to preserve whatever spacing was needed. Thanks for the answer. Not only do the line endings need to be Windows format, but you also need a linebreak after the last entry, or it wont register the last one.
Win10 — Kelly Bang. Show 1 more comment. Hengly Hengly 1 1 silver badge 5 5 bronze badges. Don't know why but it worked. Thank ya. So this was strange, I never saw this before. I added a host to the hosts file.
0コメント