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

Channel:
Subscribers:
30,000
Published on ● Video Link: https://www.youtube.com/watch?v=o6f0iGYJwq0



Category:
Guide
Duration: 7:00
23,816 views
159


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:\Windows\System32\drivers\etc\hosts
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:\Windows\System32\drivers\etc 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:\Windows\System32\drivers\etc\hosts

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/70s

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

Social Media
SUBSCRIBE https://www.youtube.com/@Websplaining?sub_confirmation=1
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!




Other Videos By Websplaining


2021-07-13How To Unpartition Or Delete Partitions For Your SSD, m.2 NVMe SSD, And HDD In Windows 10
2021-07-11How To Partition Your SSD, m.2 NVMe SSD, And HDD In Windows 10
2021-07-10How To Fix Android Smartphone Or Device Not Connecting To Your Computer For USB File Transfer
2021-07-10How To Turn Off Or On App Install Optimization On Google Play
2021-07-08How To Quickly Reformat Your SSD, M.2 NVMe SSD, and HDD In Windows 10 - How To Format Any Drive
2021-07-06How To Activate Your New SSD, M.2 NVMe SSD, And HDD In Windows 10 - Hard Disk Drive Not Showing Up
2021-07-01How To Uninstall Microsoft Edge Browser From Windows 10
2021-06-30How To Delete Your Telegram Account
2021-06-27How To Uninstall Microsoft OneDrive App In Windows 10
2021-06-25How To Find level-seed Of Your Randomly Generated Minecraft Singleplayer World or Multiplayer Server
2021-06-23How To Edit hosts File In Windows 10 - How To Block Domains & Subdomains Using Windows hosts File
2021-06-19How To Fix Minecraft Server Batch (.bat) File Cmd Closing Instantly Without Generating Any Files
2021-06-17How To Screen Record User Account Control (UAC) Prompt - How To Change UAC Notification Settings
2021-06-15How To Fix Screen Flickering While Watching YouTube Videos In Google Chrome, Brave, & Microsoft Edge
2021-06-14How To Turn Off Windows News And Interests - Turn Off Temperature & Weather Icon On Windows Task Bar
2021-06-13How To Remove Payment Methods From Your Google Account
2021-06-11How To Install Java Standard Edition (SE) Development Kit (JDK) In Windows 10
2021-06-09How To Get $100 FREE DigitalOcean Promotional Credit
2021-06-03How To Add A Server Icon To Your Minecraft Server
2021-06-02How to Convert JPG To PNG Image With A Transparent Background
2021-06-01How To Generate, Format And, Add Color To Your Minecraft Servers Message Of The Day (MOTD)



Tags:
How To Edit hosts File In Windows 10 - How To Block Domains & Subdomains Using Windows hosts File
windows hosts file
hosts
hosts file
windows
windows 10
localhost
127.0.0.1
ip address
how to block a website in your windows hosts file
How To Edit hosts File In Windows 10
How To Block Domains & Subdomains Using Windows hosts File
loopback address
127.0.0.1 loopback address
dns
Domain Name System
dns server
C:\Windows\System32\drivers\etc\hosts
Microsoft TCP/IP for Windows