How To Edit hosts File In Windows 10 – How To Block Domains & Subdomains Using Windows hosts File



How To Edit hosts File In Windows 10 – How To Block Domains & Subdomains Using Windows hosts File

How To Edit hosts File In Windows 10 - How To Block Domains & Subdomains Using Windows hosts File

How To Edit hosts File In Windows 10 – How To Block Domains & Subdomains Using Windows hosts File

In this video I will show you how to edit your windows hosts file to block website domains and subdomains.

Steps to edit windows hosts file:

1. Navigate to the bottom left hand corner of your task bar and left click on the search box
2. Type “This PC”
3. Open “This PC” application
4. Once open, navigate to the following directory on your computer C:WindowsSystem32driversetchosts
5. You should now have your Windows hosts file open, to edit this hosts file you will need to make a copy of it and place the copy on your desktop. Left click on the hosts file to select it, right click, and then select copy. Next, right click anywhere on your desktop and left click on paste
6. To edit the hosts file right click on the copy on your desktop and left click on “Open with”
7. Choose any text editor of your choice. I personally chose windows Notepad. Windows hosts file will then open as a text document in your text editor of choice for you to edit.

Steps to block domains & subdomains using Windows hosts file:
1. Once you have your Windows hosts file open, enter a comment in your hosts file to organize your mappings of IP addresses to host names
2. To add a comment, make sure you’re on a new line and type “#” followed by your comment details. The “#” symbol will tell your computer to ignore anything that comes after “#” on the same line
3. Next, again on a separate line, enter 127.0.0.1 (localhost/loopback IP address) and a space followed by your domain name or subdomain name (website address) to be blocked.

For example:
# Websplaining Personal Website Block
127.0.0.1 websplaining.com
127.0.0.1 www.websplaining.com

4. In the above example websplaining.com (domain name) and www.websplaining.com will be blocked by the windows hosts file. To save these entries, navigate to the top left hand corner to file, left click on it and left click on save.
5. Next, move the hosts file on your desktop into the following file path location C:WindowsSystem32driversetc and overwrite the old hosts file by selecting “Replace the file in the destination” and “continue” when attempting to move the new hosts file into the old hosts files, file path location. You will need to be on an administrator username on your computer to edit the windows hosts file.
6. Once your old hosts file has been overwritten with the new, open up your browser and navigate to the website URL address you have just added to your hosts file. The blocked website will now be unreachable meaning that it has been blocked successfully.

‪[Note] Windows hosts file location:
C:WindowsSystem32driversetchosts

Congratulations, you have successfully edited the Windows hosts file and blocked your desired website domain name(s) and subdomain(s)

What is a hosts file?
A hosts file, is a local text file that maps servers or hostnames to IP addresses

What is IP Address 127.0.0.1 in Windows hosts file?

The IP address 127.0.0.1 has a unique use case. It is an IPv4 address and is called the localhost or loopback address. It is often used by developers to test their applications. For example, a web server running on a computer can point to 127.0.0.1 so that the pages redirect locally and can be tested before it’s deployed online.

hosts file default contents:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# 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.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

Timestamps:
0:00 Intro & Context
0:08 Locate windows hosts file
1:17 Edit Windows hosts file
4:40 Overwrite old hosts file
5:58 Check device connectivity to blocked domain or subdomain
6:29 Closing & Outro

Grow your YouTube Channel with vidIQ https://vidiq.com?afmc=70s

Microsoft Windows 10 Tutorials – Apps & Quality of Life Guides (Playlist) https://www.youtube.com/playlist?list=PLco3v23oibTXKLWvJD3j1OXxbsiAdPXSu

Social Media
SUBSCRIBE to my YouTube Channel https://bit.ly/2EKOR4a
Instagram (Thumbnail Collection) https://www.instagram.com/websplaining
Twitter (For Newest uploads) https://twitter.com/websplaining
Reddit (Discussions) https://www.reddit.com/r/Websplaining
Personal Website https://www.websplaining.com

#Windows #hosts #hostsfile

DONT FORGET TO LIKE COMMENT AND SUBSCRIBE!

Comments are closed.