Questions tagged [hosts-file]

The "hosts file" is a common tool in operating systems to map names to IP addresses. These mappings usually take precedence over the DNS system.

The hosts file can usually be found in the following locations:

Linux

/etc/hosts

Windows

%WINDIR%\System32\drivers\etc\hosts
388 questions
98
votes
9 answers

Force Chrome to open URLs as URLs, instead of searching

I have a local Apache server running, which is defined through /etc/hosts as "apache". So I often open pages like: http://apache/website/ Normally, this works fine. However, since I am using a more recent Chrome browser, at odd moments the browser…
user95156
59
votes
4 answers

Why is Chromium bypassing /etc/hosts and dnsmasq?

I'm using hostsblock together with dnsmasq on Arch Linux to block some websites, one of them is facebook.com and www.facebook.com. I know everything is working properly because a simple ping to facebook.com (or www.facebook.com) returns 127.0.0.1.…
thiagowfx
  • 1,808
47
votes
3 answers

How do I redirect a domain to another domain locally?

My /etc/hosts file looks like this: 127.0.0.1 localhost 10.20.7.67 testsitealpha.dev othersite.dev testsitebeta.dev The first two work. The last one doesn't. Why not? How do I make it work? The reason I am doing this, is because I have…
Benubird
  • 591
45
votes
6 answers

Simulate manipulation of the etc/hosts file in Google Chrome

How can I set up Chrome to reference hostname lookups locally and not from the standard etc/hosts file? When debugging a website, it's sometimes useful to set up entries in C:\Windows\system32\drivers\etc\hosts that replace certain domains with…
43
votes
10 answers

Browser with its own hosts file?

I have a number of staging and test servers that I need to constantly modify my hosts file to access (they depend on the domain name, so I have to change the hosts file to get them to work). I find this annoying. I'd like to setup a portable browser…
42
votes
2 answers

I can't visit websites that have “.dev” domain

I'm trying to visit websites like https://get.dev, but instead of loading website, there appears "Resolving host" message and then I'm getting "This site can’t be reached get.dev’s server IP address could not be…
pawel
  • 1,761
37
votes
3 answers

What is the relevance of "fe80::1%lo0 localhost" in /etc/hosts?

Following are the entries in my /etc/hosts. I was wondering what is the last entry (fe80::1%lo0 localhost) for. 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost
harish
34
votes
6 answers

Why can't I block Facebook using /etc/hosts on Mountain Lion (OS X)?

It worked for a while in the old configuration, but then stopped working for some reason. Here is my /etc/hosts file from my Mountain Lion MacBook Air: 127.0.0.1 reddit.com www.reddit.com 127.0.0.1 facebook.com www.facebook.com ## # Host…
seanieb
  • 549
31
votes
6 answers

Hosts file for Chromebook?

Is there a way to modify the hosts file in Chrome OS? ­­/etc/hosts The file is read only, so trying to modify it using sudo vim does not work. I have read that disabling root filesystem verification would make editing the hosts file possible, but…
Bricknix
  • 411
31
votes
6 answers

Editing hosts file on Windows 8

I'm trying to edit my hosts file in Windows 8 Pro. When I open C:\Windows\System32\Drivers\etc\hosts in Notepad++ or any other text editor, make changes and attempt to save, I get a dialog that tells me "Save failed: Please check if this file is…
David Sulpy
  • 4,089
30
votes
3 answers

Curl local host names on Mac OS X Yosemite

I just upgraded from Mavericks to Yosemite, and now curl can't see loopback host names. Set up a simple http server to test: $ python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ... Now I can hit localhost:8000 in chrome. I can even wget…
27
votes
2 answers

Is there a maximum number of hostname aliases per line in a Windows hosts file?

I have a hosts file on Windows 7 that has an IP address followed by 10 different hostname aliases. I can ping the first nine, but if I try to ping the tenth, I get: Ping request could not find host tenth. Please check the name and try again. I've…
Dan
  • 905
23
votes
2 answers

Why don’t .dev domains don't resolve?

I noticed today that no .dev domains will resolve in any browser on my MacBook while trying to access web.dev; they all say “__.dev refused to connect.” I did a quick Google search for site:.dev, and all of the listed domains produce the same error,…
22
votes
4 answers

/etc/hosts getting reset in Lion

In order to do web development on my local machine, I use the /etc/hosts file to define hosts that point back to 127.0.0.1 to which I have Apache serve up via VirtualHosts. This works great, except that now it seems that Lion resets my /etc/hosts…
Jimmy Z
  • 691
22
votes
2 answers

Better to block a host to 0.0.0.0 than to 127.0.0.1?

I have a few hosts that I would like to block in my /etc/hosts file. For that I need to define a bogus IP address that the DNS queries get resolved to. Most of the tutorials I saw so far all mention 127.0.0.1 as the solution to that. But I was…
comfreak
  • 1,253
1
2 3
25 26