How to Block a Website on Safari: 12 Steps

Table of contents:

How to Block a Website on Safari: 12 Steps
How to Block a Website on Safari: 12 Steps
Anonim

This wikiHow teaches you how to prevent Safari from accessing a specific website on both iOS and Mac devices. You can perform this change using an iPhone's "Restrictions" menu. If you are using a Mac, you will need to edit the contents of the "hosts" system file.

Steps

Method 1 of 2: iPhone

Block a Website in Safari Step 1
Block a Website in Safari Step 1

Step 1. Launch the iPhone Settings app

Iphonesettingsappicon
Iphonesettingsappicon

Tap the gray gear icon. It should be visible directly on the Home of the device.

Block a Website in Safari Step 2
Block a Website in Safari Step 2

Step 2. Scroll down the menu and tap "General"

Iphonesettingsgeneralicon
Iphonesettingsgeneralicon

It is displayed at the top of the third group of options in the "Settings" menu.

Block a Website in Safari Step 3
Block a Website in Safari Step 3

Step 3. Scroll down the menu and choose Restrictions

It is displayed in the center of the page.

Block a Website in Safari Step 4
Block a Website in Safari Step 4

Step 4. Enter the PIN to access the "Restrictions" menu

This is the code you set when you turned on restrictions on your iPhone (it may not necessarily be identical to the PIN you use to unlock the device).

If you have not activated "Restrictions" yet, you will need to select the option Enable Restrictions and create the access PIN you prefer by entering it twice.

Block a Website in Safari Step 5
Block a Website in Safari Step 5

Step 5. Scroll down the page to the "Allowed content" section and select Websites

It is located approximately in the middle of the appeared menu.

Block a Website in Safari Step 6
Block a Website in Safari Step 6

Step 6. Choose the Restrict Adult Content option

It is visible at the top of the page. A blue check mark will appear to the left of the selected item to indicate that it is active.

Block a Website in Safari Step 7
Block a Website in Safari Step 7

Step 7. Press the Add a website button

You must use the button for the "Do not allow" section (and not the one in the "Always allow" section) located at the bottom of the page.

Block a Website in Safari Step 8
Block a Website in Safari Step 8

Step 8. Enter the URL of the website you want to block

Make sure you include the full address of the page you want to block (for example "www.example_site.com" instead of "example_site.com").

Block a Website in Safari Step 9
Block a Website in Safari Step 9

Step 9. Press the Done button

It is blue in color and located in the lower right corner of the keyboard. In this way the indicated website will no longer be accessible from Safari.

Method 2 of 2: Computer

Block a Website in Safari Step 10
Block a Website in Safari Step 10

Step 1. Open the Spotlight search bar by clicking on the icon

Macspotlight
Macspotlight

It features a magnifying glass and is located in the upper right corner of the screen.

Block a Website in Safari Step 11
Block a Website in Safari Step 11

Step 2. Type the terminal keyword into the Spotlight search bar

This will search for the "Terminal" app within the Mac.

Block a Website in Safari Step 12
Block a Website in Safari Step 12

Step 3. Click on the "Terminal" app icon

Macterminal
Macterminal

It should have appeared at the top of the results list visible below the search bar.

Block a Website in Safari Step 13
Block a Website in Safari Step 13

Step 4. Type the command

sudo nano / etc / hosts

inside the "Terminal" window and press the key Enter.

The command will be executed and the contents of the "hosts" file will be displayed on the screen. This is the file through which the Mac controls all the websites that can be accessed including those required by Safari.

Block a Website in Safari Step 14
Block a Website in Safari Step 14

Step 5. Enter the password of the Mac administrator account and press the Enter key

This is the password you normally use to log in to the Mac. Being a password, when you enter it in the "Terminal" window you will not see any characters appear on the screen.

Block a Website in Safari Step 15
Block a Website in Safari Step 15

Step 6. Wait for the "hosts" file to open

This step should take a few seconds to complete. When the contents of the file have appeared in a new window, you can proceed with the changes.

Block a Website in Safari Step 16
Block a Website in Safari Step 16

Step 7. Scroll through the file to the end and press the Enter key

Use the directional arrow ↓ to go to the last line of the file, then press the Enter key to create a new line of text.

Block a Website in Safari Step 17
Block a Website in Safari Step 17

Step 8. Type the IP address

127.0.0.1

and press the button Keyboard tab ↹.

This will leave some empty spaces between the address 127.0.0.1 and the new content you are going to insert.

Block a Website in Safari Step 18
Block a Website in Safari Step 18

Step 9. Enter the URL of the website you want to block

Normally you will have to type in the www prefix. followed by the website name (for example Google) and the domain name, for example.com,.net or.org.

  • The new line of text you just created should look like this: 127.0.0.1 www.facebook.com.
  • If you need to block multiple websites, each single URL must have its own dedicated line within the "hosts" file.
Block a Website in Safari Step 19
Block a Website in Safari Step 19

Step 10. Save your changes and close the text editor

After you have successfully entered all the URLs of the websites you want to block, save the file and close the editor by pressing the key combination Ctrl + O and pressing the Enter key. To close the "hosts" file press the key combination Control + X.

Block a Website in Safari Step 20
Block a Website in Safari Step 20

Step 11. Clear your Mac's DNS cache

For the new settings to take effect you will need to clear the current system DNS cache content. Type the command

sudo killall -HUP mDNSResponder

within the "Terminal" window and press the Enter key.

Recommended: