Mytour will guide you on how to block a specific website across all web browsers on your Windows or Mac computer by editing the "hosts" file. Additionally, although blocking a website on Android is not possible, you can still achieve this on an iPhone or iPad by using the Restrictions menu in the Settings app.
Steps
On Windows
⊞ Win- On Windows 8, move your mouse pointer to the upper-right corner of the screen, then click on the magnifying glass icon.
Type Notepad into the Start menu. Notepad will appear at the top of the Start menu window.
Right-click on Notepad and select Run as administrator (Execute as administrator). This option will launch Notepad with administrator privileges. Without it, you won't be able to edit the "hosts" file.
- For laptops with a touchpad instead of a mouse, you can perform a right-click by tapping two fingers on the touchpad.
Click Yes when prompted to confirm your decision and open Notepad.
Click on File and choose Open (Open).
Double-click on the C: drive, then navigate to Windows > System32 > drivers > etc. Double-click each folder until you reach the "etc" folder.
Click on the "Text Documents" dropdown menu and select All Files (All Files). You will see many file types appear in the window.
Double-click on the "hosts" file. Notepad will open the "hosts" file, allowing you to view and edit its content.
Scroll down to the bottom of the "hosts" file. You will find two lines of text containing "localhost" here.
Click below the last line of text. This line may contain either "::1 localhost" or "127.0.0.1 localhost" and will be at the bottom of the page. Make sure your cursor is placed just below the last line in this file.
- Be careful not to delete any existing content in the hosts file.
Gõ 127.0.0.1 rồi nhấn Tab ↹. Đây là địa chỉ loopback (vòng lặp) của riêng máy tính. Máy tính sẽ đáp lại bằng một trang lỗi trên trình duyệt web khi ai đó cố truy cập vào trang bị chặn.
Gõ địa chỉ trang web mà bạn muốn chặn. Chẳng hạn, nếu bạn muốn chặn Google, gõ www.google.com.
Nhấn ↵ Enter. Thao tác này sẽ di chuyển con trỏ chuột sang một dòng mới. Mã mà bạn vừa nhập sẽ cho máy tính biết để chuyển hướng trang web đến địa chỉ vòng lặp thay thế.
- Bạn có thể thêm bao nhiêu trang web muốn chặn tùy thích, mỗi trang một dòng, sử dụng dãy số tương tự (127.0.0.1).
Trên máy tính Mac

Gõ terminal vào Spotlight. Terminal sẽ xuất hiện đầu danh sách kết quả.

Gõ mã sau vào Terminal:
rồi nhấn ⏎ Return. Lệnh sẽ bắt đầu được thực thi. Tập tin "hosts" sẽ được mở bằng một trình chỉnh sửa văn bản, bên trong cửa sổ Terminal.
sudo nano /etc/hosts
Gõ mật khẩu máy tính rồi nhấn ⏎ Return. Đây là mật khẩu mà bạn dùng để đăng nhập máy tính Mac.
- Terminal sẽ không hiển thị các ký tự khi bạn nhập mật khẩu.
Di chuyển con trỏ chuột đang nhấp nháy xuống cuối trang. Để thực hiện điều này, nhấn phím ↓ cho đến khi con trỏ nằm thấp hơn dòng cuối cùng trên trang.
Gõ: 127.0.0.1. Đây là địa chỉ vòng lặp của riêng máy tính. Máy tính sẽ đáp lại một trang lỗi trên trình duyệt web khi ai đó cố truy cập vào trang bị chặn.
Nhấn Tab ↹. Con trỏ chuột sẽ di chuyển sang bên phải.
- Đừng nhấn ⏎ Return vội.
Enter the website address you want to block. For example, if you wish to block Google, type www.google.com.
Press ⏎ Return. The computer will now recognize to redirect the website to the loopback address instead.
- You can block as many websites as you like, each on a new line, using the same numeric address (127.0.0.1).
Press Control+X. This command will close the hosts file in the text editor. You will be prompted to save your changes.
Press Y to save the changes. The computer will ask you to confirm the filename. You should overwrite the original hosts file, so don't change the filename.
- To unblock a website, simply open the hosts file again in Notepad under administrator rights and delete the line containing the website you added. Be sure to save the changes after removing the lines you want to unblock, otherwise, the website will remain blocked.
On iPhone and iPad

Scroll down and tap on General (General). This option is located near the bottom of the screen on iPhone, or towards the top left on iPad.
Scroll down and tap on Restrictions located towards the middle of the General page.
Enter your passcode for restrictions. This is the passcode you use to enable restrictions on your device.
- If you haven't enabled restrictions yet, tap on Enable Restrictions first and then enter your desired passcode twice.
Scroll down and tap on Websites. This option is located at the very bottom under the "ALLOWED CONTENT" header.
Nhấn vào Limit Adult Content (Giới hạn Nội dung Người lớn). Bạn sẽ thấy một dấu tích màu xanh dương hiện lên bên phải tùy chọn này.
Nhấn vào Add a Website (Thêm một Website), bên dưới tiêu đề "NEVER ALLOW" (KHÔNG BAO GIỜ CHO PHÉP). Tùy chọn này nằm cuối cùng trong trang.
Nhập địa chỉ trang web mà bạn muốn chặn. Địa chỉ phải được bắt đầu bằng "www" và kết thúc với thẻ tên miền (chẳng hạn như ".com" hay ".net"), bạn có thể bỏ qua phần "https://" cũng không sao.
- Chẳng hạn, nếu muốn chặn Facebook trên iPhone/iPad của mình, bạn sẽ gõ
www.facebook.com.
Lời khuyên
- Thiết lập Hạn chế của iPhone sẽ áp dụng được cho cả Safari và các trình duyệt web khác trên điện thoại.
Warning
- Unlike iPhones and iPads, there is no comprehensive way to restrict website access on Android devices.
