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.

learn more… | top users | synonyms

17
votes
4answers
7k views

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 ...
10
votes
5answers
11k views

How does localhost 127.0.0.1 work?

I found some articles related to this, but they were not sufficient for me. I want to know how the localhost works and why is it the same on many different machines? How does the localhost block the ...
27
votes
8answers
5k views

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 ...
19
votes
4answers
12k views

/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 ...
15
votes
5answers
7k views

Why can't I block Facebook using /etc/hosts on Mountain Lion?

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 ...
8
votes
3answers
1k views

How do you edit hosts file on Windows 7

I'm trying to edit the hosts file (C:\Windows\System32\drivers\etc\hosts), because I want to setup a local redirect for my website (like I've always done in XP). However, I can't save the changes! I ...
4
votes
2answers
9k views

Run as administrator from command line on Windows 8

I am trying to run Notepad as admin so I can edit my hosts file from the command line. I have tried runas /user:(myusername)\administrator "notepad c:\windows\system32\drivers\etc\hosts" I then input ...
7
votes
2answers
9k views

How to make changes to Mac /etc/hosts permanent?

On my Mac (running OS 10.6.8), I can edit my hosts file with sudo vi /etc/hosts, but changes I make don't seem to persist through restarts or possibly awaking from sleep mode. Is there a way to make ...
13
votes
2answers
6k views

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 ...
2
votes
4answers
14k views

With Windows 7, why is an entry in the hosts file not working?

I updated some entries in the hosts file at C:\WINDOWS\System32\drivers\etc. As a test, I decided to make Google point to 127.0.0.1. # Additionally, comments (such as these) may be inserted on ...
2
votes
2answers
5k views

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 ...
1
vote
4answers
4k views

Browsers ignoring hosts file

Until recently my browsers started to ignore my hosts file. I have Windows 7 operating system installed. 192.168.0.5 livesite.com I have tried: Clearing browser cache Issued "ipconfig ...
0
votes
1answer
226 views

Can I have Windows use additional HOSTS entries from a file server?

I have a network of computers and a server. I often need to edit the hosts file of all the computers to add a new entry or to change one. e.g. 192.168.1.101 temporary-internal-site How can I get ...
27
votes
6answers
47k views

Editing Hosts File in 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 ...
19
votes
3answers
25k views

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 ...
1
vote
2answers
6k views

Can't map certain port and path with hosts file

On my localhost I'm trying to map http://127.0.0.1:8888/site/ to www.test.dev. Hosts file is below. When I load http://127.0.0.1:8888/site/ I see what I want but for www.test.dev I just see Firefox's ...
3
votes
5answers
2k views

Chrome does not follow hosts file

I have custom domains set up for internal web site testing in my /etc/hosts file. I try to access them in Chrome, and I get routed to a Google search instead. But when I ping the domains, they ...
3
votes
2answers
1k views

How can I redirect HTTP requests to use HTTPS?

Is it possible to automatically redirect HTTP to HTTPS? Can I amend my host file in such a way that when I visit http://www.hsbc.co.uk it will redirect me to https://www.hsbc.co.uk? or is there ...
2
votes
1answer
145 views

How to make Opera browser obey the etc/hosts file?

Current version of Opera browser doesn't obey etc/hosts file for domains outside the local network. It looks to me like it is using its own DNS resolver. For example if I create the following ...
2
votes
0answers
233 views

Cannot access shared drive in same machine uisng machine name but can access using IP

I have 4 desktops running Windows Server 2008 32bit version. I created some shares in all these machines. My program gets files from these machines (like \machine1\abcd). The machine names mentioned ...
2
votes
3answers
888 views

ad blocking host file, shared to all computers on local network

I currently update my local hosts file with advertising server domain names and direct them to nowhere. Well, almost nowhere. I point them to 127.0.0.1 and I don't have a web service running so it is ...
1
vote
3answers
591 views

Easy way to view a website at a different IP than associated with hostname?

Some background — WordPress is really annoying in terms of what hostname you access it from, which makes creating testing environments rather painful (That is, I could create a subdomain for staging, ...
1
vote
1answer
4k views

How to edit hosts file in Windows 8? Defender says malware detected

I've tried editing it in the same way as in Windows 7. E.g. opening Notepad/Notepad++ as Administrator and then opening the file and save it. Right after saving it Windows Defender will say Malware ...
0
votes
2answers
495 views

Editing /etc/hosts to use domain name instead of ip address

I have a web service running at http://192.168.1.2:5000/, I want to replace it with a typical domain name, in /etc/hosts, I'm doing something like 192.168.1.2:500 http://www.mydomainname.com but, ...
0
votes
1answer
538 views

Automatically change /etc/hosts on OS X 10.6

I edit /etc/hosts as a first line of defense to stop me going to certain distracting sites during the working day. Ideally I'd like to have two versions of hosts and a cron job that switches them ...