As of May 31, 2023, we have updated our Code of Conduct.

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.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
55 views

/etc/hosts : Block the Entire Website but Enable One Folder

The below entry in C:\Windows\System32\drivers\etc\hosts file will block the site www.rauf.com. 127.0.0.1 www.rauf.com That's fine. Now I'm looking for more advanced control just with this file. I ...
Rauf's user avatar
  • 3,567
1 vote
1 answer
142 views

Change in 'hosts' file responds to ping but refuses to connect on any browser

I'm currently working on a project where I need to emulate the live site's URL's in order to properly communicate between the projects site, projects browser extension, and the projects database. To ...
Zane Wilson's user avatar
0 votes
0 answers
77 views

How to avoid Windows host file bypass?

From this question, we know that Windows bypass the host file whenever Microsoft wants. Is there a way for deactivating the bypass / having full real control of the host file? The objective is the ...
Pablo Ruiz's user avatar
1 vote
0 answers
17 views

Vagrantfile : config.vm.provision "shell" replicate data

This is my first post here, i will try to be the more specific possible. I created a Vagrantfile in order to create a small infrastructure to make practice Ansible to my students. Here the Vagrantfile ...
Fares's user avatar
  • 11
0 votes
0 answers
132 views

How do I completely block youtube on windows 11?

I added the following in my hosts file: # Main site 127.0.0.1 youtube.com 127.0.0.1 www.youtube.com # Videos summaries in google search 127.0.0.1 encrypted-vtbn0.gstatic.com # Video thumbnails ...
nakiya's user avatar
  • 111
1 vote
0 answers
290 views

How to whitelist websites (not blacklist) in hosts files?

I'm trying to make it easy to avoid random distracting websites. I'd like to have my host file set up to only allow a few websites. Everything else should be blocked. I can't get this to work. This is ...
Sylvia's user avatar
  • 125
0 votes
1 answer
111 views

Unable to delete entries in host files

I added too many hosts file entries such that now my whole computer lags and freezes, my Chrome cannot load any websites, and my computer says that my Wi-Fi has no internet although other devices ...
DingHang's user avatar
1 vote
1 answer
505 views

how to block websites without using host file

I'm just trying to create a basic program that allows users to input websites to be blocked but editing the host file does not work at all. I tried using all the links from here for sites like reddit/...
HowePersonal's user avatar
0 votes
0 answers
65 views

Cross-domain redirect history resolved in intranet

I am currently facing a task - setting up Hosts file with IP/DNS records to mitigate badly working DNS translation through proxy server. (Either translates all DNS requests, or none. I figured it's ...
Terriaki's user avatar
0 votes
0 answers
194 views

How does Google's "lock SafeSearch" mechanism on host files actually work?

I am used to the technique of writing etc/hosts in order to block access to websites on browsers. Usually, it is something along the lines of: 127.0.0.1 facebookz.co So, the first number is the ...
Pedro Delfino's user avatar
1 vote
1 answer
387 views

How to block a website like crazygames.com?

I am trying to block crazygames.com website using the hosts file but it doesn't work. I added this line into the hosts file. 127.0.0.1 crazygames.com Pinging crazygames.com [127.0.0.1] with 32 bytes ...
hunko's user avatar
  • 13
0 votes
0 answers
13 views

Oracle EBS R12.2

How to open an EBS application server R12 without host entry on windows 10? I'm an Oracle DBA in my company and my manager asked me this question that if our clients asked that I haven thousands users ...
Mr. Anonymous's user avatar
0 votes
1 answer
26 views

Why can't I reach test.example.com from my browser, but ping in CLI can

I just want to test my CA engine from Hashicorp Vault. I've spinned up a local NGINX webserver in docker referring to test.example.com. Unfortunately I'm not able to reach it from my browser with that ...
Lucas Scheepers's user avatar
0 votes
1 answer
587 views

web browsers are not picking up my web server via the hosts file, but they pick up my web server on 127.0.0.1

I run a web server e.g. python -m SimpleHTTPServer 80 or python -m http.server 80(which of those depends on python version), and I do echo blah >index.html to write an index.html with the text ...
barlop's user avatar
  • 23.2k
0 votes
1 answer
551 views

why does it take chrome two minutes to pick up that a domain has been specified/blocked in the hosts file, and can that time be decreased a lot?

I'm specifying certain domains in my hosts file to block them. So redirecting a domain to 127.0.0.1 when i'm not running any web server on 127.0.0.1 will block that domain. why does it take chrome two ...
barlop's user avatar
  • 23.2k
0 votes
0 answers
188 views

Locally map or redirecting an URL to another URL for the client side?

Is it possible to redirect an URL to another URL, for the client only. As example. Let's say, I type this in the URL browser https://google.com/this_page_does_not_exist/it_doesnt_exist it just gives ...
karl-police's user avatar
1 vote
0 answers
54 views

Is there a way to detect when a domain is caught by the Hosts file?

On Windows, I use the etc/hosts file to block some domains, for example because they are often used to serve ads. But sometimes, a program tries to connect to a blocked domain for a legitimate reason ...
ETL's user avatar
  • 188
2 votes
1 answer
788 views

Localhost addresses stopped working after installing Docker

I am used to develop with Vagrant. My Windows hosts file uses multiple addresses mapping which used to work just perfect: 127.0.0.1 whatever.local But after installing Docker Desktop, they have ...
Álvaro Franz's user avatar
2 votes
0 answers
97 views

Can I force a web proxy to use a specific IP address for a hostname?

Background: I want to test a site on Akamai's staging network. This usually requires you to find out the IP address of the specific edge hostname and then change your local /etc/hosts file so the ...
bellackn's user avatar
  • 151
4 votes
1 answer
473 views

What's the difference for a hosts file when deciding to use 127.0.0.1 or 0.0.0.0?

Since 0.0.0.0 matches any address and 127.0.0.1 is localhost, when deciding whether to choose one or the other to map unwanted IPs and domains in a hosts file, when is each best? I read that in terms ...
user avatar
1 vote
2 answers
2k views

how to block subdomains using host file in windows

I have seen that I can block access to web pages with the host file: 127.0.0.1 www.facebook.com how can I block all subdomains? *.facebook.com
user avatar
0 votes
1 answer
51 views

Blocking single webpage of a website

I want to block google homepage, but want search result by typing keyword in browser's search bar. I tried extension and host file approach, but it will make all of google in-accessible. So I don't ...
user146551's user avatar
1 vote
1 answer
307 views

"# Auto-generated hostname. Please do not remove this comment." Why not?

In CentOS (but possibly other distros), /etc/hosts has the following comment: # Auto-generated hostname. Please do not remove this comment. Since the comment itself asks not to be removed, it seems as ...
Aaron Cicali's user avatar
1 vote
1 answer
470 views

why is Editing Hosts file for redirecting to IP of my choice giving a 404 error

i edited the hosts file in Linux at etc/hosts where i put two entries at the end as 127.0.1.1 brij-Latitude # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-...
Brijraj's user avatar
  • 13
3 votes
1 answer
2k views

Some websites bypass hosts file in Safari

I downloaded a hosts file from a Github which lists all porn websites, in order to block them on my computer. This works well with Chrome, unfortunately on Safari some websites are not blocked at all. ...
nikos974's user avatar
2 votes
1 answer
371 views

How does linux resolve wildcard locahost subdomains (e.g. : `ping test.localhost`) when `test.localhost` does not exist in /etc/hosts or dns server?

For example in ubuntu 20.04 LTS where the /etc/hosts file is empty: >>> cat /etc/hosts 127.0.0.1 localhost ping still works for any subdomain of localhost: >>> ping test....
Greg's user avatar
  • 453
0 votes
1 answer
203 views

How to block specific websites in a specific browser?

I want to block Youtube in Chrome and Firefox, but not in Chromium, is there a way to do this? The only solution I found is adding this to the hosts file 0.0.0.1 youtube.com 0.0.0.1 www.youtube....
burny's user avatar
  • 1
1 vote
0 answers
225 views

Can't block site in /etc/hosts

In my /etc/hosts I have added this line to block the www.bbc.com/persian: 127.0.0.1 www.bbc.com/persian I am using Firefox on Antix Linux (Debian), and had no success, the site can still be reached ...
Student's user avatar
  • 111
1 vote
1 answer
282 views

redirect http request for microsoft.com to a local server?

I have been using host file to redirect required outgoing traffic to my localhost normally i would just do something like this in the host file : 127.0.0.1 microsoft.com www.microsoft.com but now ...
Sanders's user avatar
  • 11
1 vote
1 answer
315 views

How do I save my Windows 10 hosts file?

Before someone goes and marks this as a duplicate, please understand that I have tried all of the following: Running notepad as an administrator, editing the file and attempting to save. No luck. ...
jlavallet's user avatar
  • 131
0 votes
0 answers
351 views

Why would a “hosts” file prevent a VPN from forwarding a port?

I would like to maintain my hosts block list while being able to use my VPNs forwarded port service, but have a conflict. I connect to a VPN server that port forwards, and my HOSTS file has only the ...
John's user avatar
  • 377
1 vote
1 answer
1k views

Set-Content : Stream was not readable - trying to understand why and how to more gracefully fail

I have the following line in my PowerShell script (Get-Content C:\Windows\System32\drivers\etc\hosts -Raw) -replace '[\d]+\.[\d]+\.[\d]+\.[\d]+ local.mywebsite.com',"$ipAddress local.mywebsite....
neubert's user avatar
  • 6,653
1 vote
1 answer
152 views

Why doesn't tinder.com redirect to 127.0.0.1 in /etc/hosts?

In my /etc/hosts file in macOS Mojave 10.14.6 I have 127.0.0.1 someotherdistraction.com 127.0.0.1 https://www.tinder.com 127.0.0.1 https://tinder.com 127.0.0.1 www.tinder.com someotherdistraction.com'...
jMan's user avatar
  • 131
7 votes
2 answers
2k views

DNS resolution delay for entries in /etc/hosts

For the purposes of doing web development, I have several domain names specified in my /etc/hosts. These represent several different websites that are being run locally. 127.0.0.1 site1.local 127.0....
leecbaker's user avatar
  • 373
0 votes
1 answer
967 views

/etc/hosts file not properly blocking site in ubuntu

I am trying to block certain sites from my computer (namely, reddit) in order to get some work done. However, modifying the /etc/hosts file seems to have no effect. I am working under Ubuntu 18.04 ...
WNG's user avatar
  • 340
0 votes
2 answers
279 views

How to change result of hostname command

when I issue a hostname command in my Centos 7 server, I get this response: vps.example.com I have changed /etc/hosts file with this: 204.93.xxx.xxx mail.example.com However, when I issue hostname ...
jstuardo's user avatar
  • 267
1 vote
0 answers
35 views

What else can stop me from accessing my WIndows 7 etc/hosts file?

Microsoft have recently rolled out a ridiculous change to Windows Defender which "detects" the deliberate blocking (via the hosts file) of Microsoft and other telemetry domains as an "...
Brent.Longborough's user avatar
0 votes
0 answers
51 views

How can I prevent my computer from accessing thousands of websites?

I'd like to block access to domains from my computer. This is what I tried I tried to use the domain filter in my router, but it applies only the HTTP websites. Any website that relies on HTTPS gets ...
tadon11Aaa's user avatar
2 votes
1 answer
5k views

hosts file but for whole network?

I can't believe I can't find this after an hour of Google. This has go to be simple! On my PC, I edit HOSTS file so say, for example, domain.com goes to local IP 192.168.1.5 Great, that's fine. But ...
bcsteeve's user avatar
  • 287
0 votes
0 answers
538 views

How to visit ssl enabled development website when using hostfile

Pre "ssl required" on domains, to visit a development site on a development computer (Windows), I edit my host file and point the domain to the development server IP address. Which was working ...
Wayne's user avatar
  • 187
0 votes
2 answers
287 views

Windows 10 - Blocking a Website in Hosts File

I have blocked a lot of websites in my Windows 10 OS computer and edited the hosts file located in C:\Windows\System32\drivers\etc. Below is the content of my hosts file: 127.0.0.1 www.facebook.com ...
alyssaeliyah's user avatar
0 votes
1 answer
193 views

Hosts file on OpenWRT router blocks cmd connections, but Chrome still connects

I have OpenWRT installed on a TP-Link Archer C7 router, and have added 0.0.0.0 domain.com to /etc/hosts. This seems to have the desired effect when ping-ing, nslookup-ing or curl-ing that domain on a ...
Kenny83's user avatar
  • 230
2 votes
1 answer
1k views

Windows 10 hostfile url to IP address of machine

Is it possible to use a fixed url to redirect to the IP of my own PC? I use DHCP and I have no problem with it but would like to use an url i.e. "server.local" to reach a web server deployed on the PC ...
breakline's user avatar
  • 121
2 votes
1 answer
3k views

How to make changes to Mac OS hosts file take effect?

I frequently edit my /etc/hosts file to block access to distracting websites when I'm trying to work (e.g. I'll add a line like 127.0.0.1 www.nytimes.com). Until recently, changes to the hosts file ...
dB''s user avatar
  • 123
2 votes
4 answers
968 views

Force Windows 10 to always open hosts file with Notepad++

The Windows hosts file does not have an extension so Windows 10 by default does not allow creating a permanent association with a program. How can I open the hosts file with Notepad++ without Windows ...
John's user avatar
  • 2,017
1 vote
1 answer
131 views

Overriding a CNAME within a CNAME chain works on Ubuntu but not Windows

Best practices aside (not having CNAME chains), I am curious to know why this is happening. I have the following: CNAME subdomain.example.com -> CNAME other.example.com -> A 172.17.0.1 If I wanted ...
Astrumas's user avatar
4 votes
3 answers
37k views

My host file is not working on Windows 10

This is crazy, I've never has this issue until now...I like to use the hosts file to block certain websites. But for some reason my hosts file is not blocking any website. I went over this post (Hosts ...
echo's user avatar
  • 53
0 votes
0 answers
75 views

What is the most effective way of remotely controlling the hosts file?

I need to control the hosts file on other Windows machines. I have administrator access on those machines and can install anything, the only question is — what to install? Ideally I would simply make ...
Dmitri Nesteruk's user avatar
0 votes
2 answers
2k views

Unable to unblocked the sites in Hosts File

I blocked some site in Hosts File, but when I tried unblocking it by deleting the indicated sites. I'm still unable to access the sites. Can anyone help me with this? I blocked the sites by using ...
Rai Sobere's user avatar
1 vote
1 answer
1k views

Redirect website url to a different url of that website (hosts)

I am unsure if this is possible. I am trying to use the Window's hosts file to redirect the address www.youtube.com to music.youtube.com. When I ping youtube.com, I am returned with this IP: 172....
RATIU5's user avatar
  • 175

1
2 3 4 5
8