The “HOSTS” file is a computer file used by an operating system to map hostnames to IP addresses. The file is used for several purposes, including:
Block websites: You can use the HOSTS file to block access to specific websites by mapping the hostname of the website to an invalid IP address.
Redirect websites: You can use the HOSTS file to redirect traffic from one website to another by mapping the hostname of the original website to the IP address of the new website.
Speed up domain name resolution: By mapping frequently visited websites to their IP addresses in the HOSTS file, you can improve the speed at which your computer resolves the domain names of those websites.
The HOSTS file is a simple text file, and can be edited using a text editor such as Notepad on Windows or TextEdit on macOS. The file typically resides in the following locations:
- Windows:
C:\Windows\System32\drivers\etc\
- macOS:
/private/etc/
- Linux:
/etc/
To edit the HOSTS file, you will need to have administrator privileges.
Here’s an example of how you can use the HOSTS file to block access to a specific website:
Open the HOSTS file using a text editor.
Add the following line to the file:
127.0.0.1 example.com
- Save the file.
This maps the hostname “example.com” to the IP address “127.0.0.1”, which is the localhost address. Any attempt to access “example.com” will now be redirected to the localhost, effectively blocking access to the website.
Note: Keep in mind that the HOSTS file is a simple text file and is not a very secure way to block access to websites. Advanced users may be able to bypass the blocks by editing the HOSTS file themselves.
You can also read more articles on blog
![chyba_wordpress_6_hlavni - Jiří Vaněk - Jiří Vaněk Kritická chyba po aktualizaci na WordPress 6.5.5.](https://blog.jirivanek.eu/wp-content/uploads/2024/06/chyba_wordpress_6_hlavni-1024x288.webp)
How To Fix a Critical Error After Updating To WordPress 6.5.5.
![nextcloud_navod_hlavni - Jiří Vaněk - Jiří Vaněk Instalace Nextcloud na sdílený hosting (pomocí FTP)](https://blog.jirivanek.eu/wp-content/uploads/2024/06/nextcloud_navod_hlavni-1024x288.png)
Simple Installation of Nextcloud on Shared Hosting (via FTP)
![zakaz_mailove_adresy_hlavni - Jiří Vaněk - Jiří Vaněk Jak zakázat přihlášení do WordPressu pomocí e-mailové adresy](https://blog.jirivanek.eu/wp-content/uploads/2024/06/zakaz_mailove_adresy_hlavni-1024x288.webp)
How to easily disable WordPress login with e-mail address
![automatic_updates_disable_main - Jiří Vaněk - Jiří Vaněk Zakažte automatické updaty WordPressu pomocí snippetu](https://blog.jirivanek.eu/wp-content/uploads/2023/07/automatic_updates_disable_main-1024x288.webp)
Safer Updates in new WordPress 6.6
![wp_rocket_hlavni - Jiří Vaněk - Jiří Vaněk WP Rocket - výpadky serverů zpomalují WordPress weby](https://blog.jirivanek.eu/wp-content/uploads/2024/06/wp_rocket_hlavni-1024x288.webp)
WP Rocket – Server Outages Slow Down WordPress Websites
![loader_io_hlavni - Jiří Vaněk - Jiří Vaněk Jak provést zátěžový test Vašeho WordPressu - hlavní náhledový obrázek ke článku](https://blog.jirivanek.eu/wp-content/uploads/2024/06/loader_io_hlavni-1024x288.webp)
How To Perform A Simple Load Test On Your WordPress Site
![disable_updates_main - Jiří Vaněk - Jiří Vaněk Jak ve WordPressu zakázat automatické aktualizace](https://blog.jirivanek.eu/wp-content/uploads/2023/04/disable_updates_main-1024x283.webp)
New and better WordPress 6.5 with codenamed Regina
Affiliate SEO Secrets: Optimizing Your Content for Search Engine Visibility
![zabezpeceni_wordpressu_pruvodce_2024 - Jiří Vaněk - Jiří Vaněk Jak zabezpečit WordPress - kompletní průvodce 2024](https://blog.jirivanek.eu/wp-content/uploads/2024/02/zabezpeceni_wordpressu_pruvodce_2024-1024x288.webp)