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
Step 1. Launch the iPhone Settings app
Tap the gray gear icon. It should be visible directly on the Home of the device.
Step 2. Scroll down the menu and tap "General"
It is displayed at the top of the third group of options in the "Settings" menu.
Step 3. Scroll down the menu and choose Restrictions
It is displayed in the center of the page.
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.
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.
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.
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.
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").
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
Step 1. Open the Spotlight search bar by clicking on the icon
It features a magnifying glass and is located in the upper right corner of the screen.
Step 2. Type the terminal keyword into the Spotlight search bar
This will search for the "Terminal" app within the Mac.
Step 3. Click on the "Terminal" app icon
It should have appeared at the top of the results list visible below the search bar.
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.
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.
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.
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.
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.
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.
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.
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.