This wikiHow teaches you how to prevent Safari from accessing certain sites on both iPhone and Mac platforms. You can change this setting from the " Restrictions " menu on your iPhone, but you'll need to edit the hosts file on a Mac if you want to block sites on the desktop version of Safari.
Step
Method 1 of 2: Via iPhone
Step 1. Open the iPhone settings menu (“Settings”)
Touch the app icon that looks like a gray gear to open it. Usually, the icon Settings ” can be found on the device's home screen.
Step 2. Swipe the screen and touch
"General".
This option is at the top of the third main group of options, at the top of the “Settings” page.
Step 3. Scroll down and select Restrictions
It's in the middle of the page.
Step 4. Enter the restriction passcode or “Restrictions”
This code is set when you previously enabled the restriction feature, and is not always the same as the regular passcode applied to the device.
If you haven't enabled the restriction feature, touch the option “ Enable Restrictions ” and enter the desired passcode twice.
Step 5. Scroll to the "ALLOWED CONTENT" section and tap Websites
This segment is in the bottom half of the page.
Step 6. Touch Limit Adult Content
It's at the top of the screen. A check mark will appear on the left side of the option and indicate that this option is active.
Step 7. Touch Add a Website
Select this option in the " NEVER ALLOW " section (not the " ALWAYS ALLOW " segment) at the bottom of the page.
Step 8. Type in the website URL
The URL entered is the URL of the website you want to block. Make sure you include all parts of the site URL (eg "www.example.com" and not just "example.com").
Step 9. Touch Done
It's a blue button in the lower-right corner of your keyboard. After that, the selected website will be blocked in Safari.
Method 2 of 2: Via Desktop
Step 1. Open the Spotlight app
Click the magnifying glass icon in the upper-right corner of the screen.
Step 2. Type terminal into the Spotlight window
After that, your Mac will search for the Terminal app.
Step 3. Click
"Terminals".
This option is the top search result displayed below the Spotlight search bar.
Step 4. Type
sudo nano /etc/hosts
in the Terminal window and press the button Returns.
The command to open the hosts file will be executed. These files are files on your computer that control websites that are accessible in all web browsers, including Safari.
Step 5. Enter the computer administrator password and press the Return key
The password entered is the password used to log into the Mac computer. You won't see any characters when you type your password, but each character will still be entered into the Terminal window.
Step 6. Wait for the hosts file to open
This process takes only a few seconds. Once the file is opened in a new window, you can move on to the file editing process.
Step 7. Scroll to the bottom of the rice and press Return key
Use the arrow keys to move to the bottom of the file. Press Return key to create a new line.
Step 8. Type
127.0.0.1
and press the button tab.
After that, a sufficiently large space or space will be added between the code 127.0.0.1 and the next text.
Step 9. Type in the URL of the website you want to block
Generally, this URL includes the www., website name (eg Google), and.com,.net, or.org sections.
- This line of code should look like: 127.0.0.1 www.facebook.com.
- If you want to block multiple websites, each URL must be added to its own line.
Step 10. Save the file and close the editor window
After entering all the sites you want to block, save the file and exit the editor window by pressing the Control+O key combination and pressing Return. To exit the hosts file, press the key combination Control+X.
Step 11. Clear DNS
For the setting effect to take effect, you need to clear the DNS cache. You can leave it blank by typing
sudo killall -HUP mDNSResponder;say DNS cache has been flushed
and pressing the Return key.