Windows 11でウェブサイトをブロックするのは複雑に聞こえるかもしれませんが、hostsファイルの編集に慣れてしまえば、実はとても簡単です。ただし、Windowsは巧妙に操作をするため、メモ帳を適切な権限で実行する必要がある点が大きな問題です。管理者権限なしでhostsファイルを変更しようとして保存できないというトラブルに見舞われる方もいます。この方法は、サードパーティ製のソフトウェアに頼らずに、自分や子供のためにいくつかのサイトを素早くブロックしたい場合に最適です。ただし、これはシステム全体ですべてをブロックするため、ChromeやEdgeだけでなく、すべてのブラウザに影響します。それでもアクセスしてくるサイトがある場合は、エントリが正しく保存されているか確認してください。
Windows 11でウェブサイトをブロックする方法
管理者としてメモ帳を開く
まず最初に、メモ帳を管理者権限で起動する必要があります。そのためには、「スタート」をクリックし、「メモ帳」と入力して右クリックし、「管理者として実行」を選択します。Windowsが許可を求めるセキュリティポップアップを表示することがありますが、同意してください。なぜこれが重要なのでしょうか?管理者権限がないと、hostsファイルなどのシステムファイルに重要な変更を加えることができないからです。環境によっては、この方法でメモ帳を開くのが妙に面倒な場合があります。もし最初の起動でうまくいかなかった場合は、メモ帳を管理者として再起動してみてください。
Hostsファイルを開く
メモ帳を管理者として起動したら、「ファイル」>「開く」に進みます。次に、 に移動しますC:\Windows\System32\drivers\etc
。ここで注意すべき点があります。デフォルトのファイルを開くダイアログでは、*.txt以外のすべてのファイルがフィルタリングされるため、hostsファイルは表示されません。下部にあるドロップダウンを「テキストドキュメント(*.txt)」から「すべてのファイル(*.*)」に変更します。次に、hostsを選択します。見つからない場合は、パスを再確認するか、アクセスしやすい場所にコピーしてみてください。このファイルを開いて、ブロックするサイトをシステムに指示する必要があります。
ブロックするウェブサイトのURLを追加する
ここで魔法が起こります。hostsファイルの一番下までスクロールし、次のように入力します。127.0.0.1 followed by a space, then the domain name of the website you want to block, like www.facebook.com. For example:
127.0.0.1 www.facebook.com
You can add multiple entries — just keep each one on its own line. For some of my setups, I’ve had to flush DNS or restart the browser, ’cause Windows is stubborn about caching DNS info. Also, note that blocking might not work immediately in some browsers; clearing cache or restarting them helps.
Save the Changes and Close the Hosts File
Once you've added all the sites, hit File > Save. Don’t mess around with anything else. Make sure you save it as a plain text file and don’t accidentally remove existing lines or add extra formatting. Close Notepad. Your changes are now in effect, but sometimes, Windows is slow to recognize them—just a heads up.
Clear Browser Cache to Make Sure the Block Works
It’s not enough to just save; browsers can cache DNS info or website data. So, go into your browser settings, find Clear browsing data, and clear cache and cookies. For Chrome, it’s under Settings > Privacy and Security > Clear browsing data. For Edge, similar menu. Restart your browser afterward. If the site still loads, try a different browser just to rule out browser cache issues.
Tips for Blocking Websites on Windows 11
- Always back up the hosts file before making changes, just in case you mess it up. To do this, copy it somewhere safe before editing.
- If blocking sites with hosts isn’t enough or gets annoying, consider parental control tools or third-party blocking software. Sometimes, hosts file tweaks are too blunt.
- Test your block by visiting the sites in multiple browsers or devices. Random browsers or refreshing might show the site still loading if you missed a step.
- Keep your hosts file updated if you decide to block more sites later. Combining this with DNS filtering or router-based solutions can be more efficient for larger setups.
- Be cautious editing system files—an easy typo can cause issues with network connectivity.
FAQs
Can I unblock websites after blocking them?
Yes, just open the hosts file again, find the lines you added, and delete them. Save, clear cache, and they should be accessible again. Easy peasy.
Does this method work for all browsers?
Yup. Windows checks the hosts file system-wide, so Chrome, Edge, Firefox, they’re all affected. No browser-specific tweaks needed.
Will it block websites on other devices?
No. This only affects the device where you edit the hosts file. To block on other devices, you’d have to repeat this process or use network-wide controls.
What if I get an error when saving?
Probably missed running Notepad as admin, or the file is still open elsewhere. Make sure Notepad has admin rights and that you close all other apps using the hosts file.
Can I block websites with keywords?
Hosting tweaks only handle specific domains. For blocking by keywords or more advanced filtering, check out third-party tools like parental control apps or network filters.
Summary
- Open Notepad as Administrator
- Navigate to C:\Windows\System32\drivers\etc
- Open the hosts file
- Add entries like 127.0.0.1 www.example.com
- Save and close
- Clear browser cache
Wrap-up
This method is kind of a classic but still super effective way to block websites on Windows 11. It’s not perfect—browsers or apps might cache DNS info for a bit—but for quick blocking, it works well. Just remember, messing with system files always comes with a risk, so backups are your friend. Once you get the hang of it, you can have some control over the web experience without relying on external programs. Fingers crossed this helps someone save a few hours of confused troubleshooting.