
In case, you're not comfortable with the steps mentioned below, I'll strongly advise you to opt for an app instead of doing it manually. It's always better to avoid it if you're not sure what you're doing.
So, let's get started and see how we can block select websites permanently to increase our productivity. You can of course remove a website from blocking, at a later date, if you want to do so.
Using Microsoft's Built-in Protection
Let's say your kids access a shared computer at your home and you want to block certain websites for their account. You can do so through the Microsoft account used to log in to the PC. Here's how to do it.Go to Settings → Accounts → Family and other users option.

Here, click the Add a family member option button. If your kid already has an account, enter the respective email address else click the link to create a new account for your child.
Follow the prompts to complete the account creation process. At the end of the process, you see a newly created child account in the list as shown below.

Now, it's time to start the website blocking process. To do that, start with clicking the link mentioning family settings as shown above. It'll take you to your account's family settings. If you're already not logged in, complete the log-in process to go to that page.

Now, go to the More options → Content filters option.
Now, here if you'll start filtering websites and searches, by default, they'll be only applicable on the Microsoft Edge browser. If you're using any other web browser like Chrome or Firefox, the settings won't work with them.

So, to make sure the filtering options work on all of your web browsers, go to the Apps and games tab and remove the web browsers you use from the list. Now go back to the Web and search tab.

Here, switch on the filtering option as shown above. Microsoft provides two ways to filter websites. The first one is to block everything and allow only the ones specified by you.

And, the second method is to allow everything and only block the ones you want to. My preference is the second approach. But, if you want to be too restrictive, go ahead with the first approach.
You can add as many sites as you want by providing the URL of each one of them. It's a one-time exercise. Once configured, it gives you peace of mind that your kids are not accessing unwanted websites.
Using Hosts File Blocking Mechanism
There's another way to block websites which involves editing a special file found on almost all popular desktop operating systems. One needs to enter the website details in a specific format in this file to block them completely. Here's how to do it on Windows.Press
Windows + S
key and type notepad
in the search box.
Right-click on the notepad application and select Run as administrator option from the context menu. Press
Ctrl + O
to open the file opening dialogue box.Go to C:\Windows\System32\drivers\etc and select the
hosts
file in that directory.
If you can't see the
hosts
file in that directory, select the All Files option to display it for selection as shown above. Now at this point, you have the hosts file opened and ready for editing.
If you want to block
yahoo.com
, all you need to do is to enter the IP address 0.0.0.0
followed by a space and the domain name as shown in the image above.For each website, you need to do the same on a new line. Save the file and that's it! In the future, if you ever want to access that website again, just remove its entry from the
hosts
file.On a Linux system, the method is the same differing only in the file path and the command to edit it. Here's how to do it.
For example, if you want to block
yahoo.com
on Linux, use the following command.
sudo sh -c 'echo "0.0.0.0 yahoo.com" >> /etc/hosts'
Here the file path is
/etc/hosts
, and the sudo
prefix is necessary to get the admin privilege required to edit that file.So, whichever method you prefer, feel free to use it to block websites on your Windows or Linux machines. I use a specialized application for the same, but you can use these techniques too.