You can prevent Safari from accessing a specific site, whether on iPhone or Mac. You can change the settings in the Restrictions menu on iPhone, but you will need to edit the hosts file on Mac to block a website.
Method 1 of 2: Set up Safari on iPhone
Step 1. Open your iPhone settings
Press the gray toothed wheel app. Usually found on the home screen.
Step 2. Scroll down and press
General can be found in the third group of options at the top of the settings page.
Step 3. Scroll down and tap Restrictions
This option is in the middle of the page.
Step 4. Enter your restrictions code
This is the code you created when you activated the restrictions. It may be different from your iPhone password.
- If you haven't activated your restrictions yet, tap Activate restrictions then enter your password twice.
Step 5. Scroll down to the Allowed Content section
Tap Websites which is in the middle of the page.
Step 6. Tap Limit adult content
This option is at the top of the page. A blue check mark will appear next to it to indicate that it has been activated.
Step 7. Select Add Website
Select this option in the section NEVER AUTHORIZE (and not in the section ALWAYS ALLOW) at the bottom of the page.
Step 8. Enter the URL of your website
This must be the website you want to block. Be sure to include all elements of the URL (eg "www.example.com" not "example.com").
Step 9. Tap Done
It's a blue button at the bottom right of the keyboard. The website you specified will be blocked in Safari.
Method 2 of 2: Set up Safari on a Mac
Step 1. Open Spotlight
Click on the magnifying glass icon in the upper right corner of the screen.
Step 2. Type terminal in Spotlight
Your Mac will search for the Terminal application.
Step 3. Click
It should appear at the top of the results under the Spotlight search bar.
Step 4. Type
sudo nano / etc / hostsin the Terminal.
Press the Return key to issue a command that will open the hosts file. This is a file on your Mac that controls which websites you can access on all web browsers, including Safari.
Step 5. Enter your administrator password and press Return
This is the password you use to log into your Mac. You will not see the characters displayed, but they will still be entered in Terminal.
Step 6. Wait for the hosts file to open
It may take a few seconds, but once it opens you can edit it.
Step 7. Scroll to the end of the file and press Return
Use the down arrow to navigate to the end of the file. Press the Return key to create a new line.
Step 8. Type
127.0.0.1and press Tab ↹.
This should leave enough space between 127.0.0.1 and the next piece of text.
Step 9. Enter the URL of the website you want to block
This involves typing www., The name of the website (eg Google) and. com,. net or. org.
The line should look something like:
- If you are blocking multiple websites, each URL will need to be entered on a different line.
Step 10. Save and exit the editor
Once you have indicated all the sites you want to block, save and exit the editor by pressing
Ctrl + O then Return. To exit the hosts file, press Ctrl + X.
Step 11. Clear your DNS cache
For the changes to take effect, you must clear your DNS cache by typing
sudo killall -HUP mDNSResponder; say DNS cache has been flushedand pressing Return.