Summary
To block a website on your PC or Mac, there is no need to resort to the use of third-party software.
The method that we propose to you in the rest of this tutorial is simple and free. On Windows, it even allows you to prevent access to certain Internet pages based on a user or a time of day.
How to block a website from your PC
To block a website from your computer, you just have to go through your Windows HOSTS file. Below, we have put together the steps to follow:
- Open theFile Explorer, then go to Windows C: → Windows → System32 → drivers → ..
- Right-click Hosts → Open with → Notepad.
If the hosts file opens through another program, go to Start → All the programs → Accessories → NotepadAnd click File → Open → hosts. - Once on Notepad, place your mouse cursor at the end of the last line, then press Starter.
- type 127.0.0.0.1, make a space, then enter the address of a website you want to block.
For example, to block access to YouTube, or even Netflix, type 127.0.0.0.1 www.youtube.com on this line. - Click on File → Save to confirm your changes.
- Close all browser windows, then go to them again.
Now, previously blocked sites should no longer show up in any browser.
Block a website based on user or time of day
To prevent access to certain websites based on time or user, you must go through the web interface of your router.
- Open your internet browser and enter theIP adress of your router in the address bar.
Refer to your router for its IP address or try a common address like http://192.168.1.1, http://192.168.0.1 or http://192.168.2.1. - Enter your username and password.
- Router interfaces vary by brand, but you will always find a tab Access restrictions.
- Enter the details of the sites, times, and users you want to block.
How to block a website from a Mac
To prohibit access to certain sites from macOS, it is possible to configure a “parental control” via the preference Screen time in your settings. Here's the procedure to follow :
- Click on the Apple and open System Preferences.
- Click the option Screen time.
- In the left column, go to Content and confidentiality.
- Click on Enable, top right
- In the tab Contents, click on Authorized websites only ou Adult Websites.
- Then on Personalize their campaigns, finally add the sites of your choice.
Otherwise, you can go through the Terminal. For this, go to Finder → Applications → Utilities → Port. Enter the command line sudo nano / etc /hosts, then tap Starter.
Enter your administrator password, at the bottom of the Hosts file you must create a new line by pressing Starter after localhost. Type 127.0.0.1 followed by a space and the url to block (without http:// or https://).