Follow these steps to change the Hosts file in Windows 10, :
Open my computer and open the Windows folder,
go to the following location: C:\Windows\System32\drivers\etc
Find the file named "hosts" in the "etc" folder. It is a text file without an extension.
Right-click on the "hosts" file and select "Open with" from the context menu. Choose a text editor like Notepad or Notepad++.
If prompted, choose to open the file as an administrator to have the necessary permissions to modify it.
The Hosts file contains mappings of IP addresses to hostnames. Each mapping is represented by a line in the file.
To add a new entry, go to a new line at the bottom of the file and enter the IP address followed by a space or tab character, and then enter the hostname or domain name.
For example: 127.0.0.1 example.com
If you want to block a website, you can map its hostname to the loopback address (127.0.0.1) to redirect it to your local machine.
Save the changes to the "hosts" file and close the text editor.
The changes should take effect immediately. However, if you find that the changes are not being applied, you may need to flush the DNS cache. Open the command prompt as an administrator, and run the command: ipconfig /flushdns.
Please note that modifying the Hosts file can affect how your computer resolves domain names, so make sure to be careful when making changes, and always back up the original file before making any modifications.