![how to modify hosts file in windows 8 how to modify hosts file in windows 8](https://www.howtogeek.com/wp-content/uploads/2015/02/Windows_104-650x349.png)
- #How to modify hosts file in windows 8 how to#
- #How to modify hosts file in windows 8 code#
- #How to modify hosts file in windows 8 Pc#
- #How to modify hosts file in windows 8 windows 8#
However, there are third-party lists of sites and domains. If you have just a handful of sites you’d like to block you can input them manually like already discussed.
![how to modify hosts file in windows 8 how to modify hosts file in windows 8](https://img.webnots.com/2015/03/How-to-Edit-Hosts-File-in-Windows-8-and-8.1.png)
You can also use the hosts file as a way to perform content filtering and ad blocking.
#How to modify hosts file in windows 8 Pc#
If the PC has a web server enabled, such as Microsoft’s built-in Internet Information Services (IIS), and you want to redirect a website or hostname to the local server you can redirect to the localhost IP of 127.0.0.1.
![how to modify hosts file in windows 8 how to modify hosts file in windows 8](https://linuxize.com/post/how-to-edit-your-hosts-file/linux-hosts-file.jpg)
Adding an extension ensures this won’t happen. You could also use the hosts file to create shortcuts to websites or internal sites or services, such as your company site or the web-based interface of your router and other network components.įor instance, to add the shortcut of “” to point to your router’s IP address of 192.168.1.1:ġ92.168.1.1 Though you could just use “router” as the hostname, again some browsers won’t treat that as a domain name and redirect to search results.
![how to modify hosts file in windows 8 how to modify hosts file in windows 8](https://winhelp2002.mvps.org/hostswin8_install.jpg)
If the IP address of your company server is 64.40.151.12, you’d enter the following lines:Ħ4.40.151.12 Or if you’d simply like to block Facebook without redirecting to another site, you can enter all zeros for the IP:Ġ.0.0.0 This would cause a DNS error and depending upon the browser, the user may see a DNS error page or a search page with results related to the domain they’re trying to visit. For instance, if you don’t want them on Facebook, you can redirect to your company site. You can use the hosts file to redirect or block websites users try to visit.
#How to modify hosts file in windows 8 how to#
In the next sections, I’ll discuss how to make specific modifications. This is because some web browsers will think you’re trying to perform a search if a domain extension isn’t included and will return search results instead of taking you to the IP you’ve designated. When redirecting a custom hostname (rather than a real website), it’s a good idea to add an extension (such as. When redirecting a real website URL, you should include one redirect with the www and another without, to ensure both will be redirected to your desired IP. Just enter the IP address of the desired server or host, leave a single space, and then enter the domain or hostname you want to point to that IP. Inserting a redirect into the hosts file is simple. After making changes to your hosts file, consider inserting your own comments so you’ll know what the entries are for. Once you have the hosts file open you’ll see most default text is comments, those lines beginning with the pound (#) sign. If you don’t see it, ensure you’re viewing All Files instead of just TXT files. In either Windows version, you can find the hosts file inside the following directory: C:\Windows\System32\drivers\etc. Once done, open Notepad: hit the Win key, type notepad, right-click Notepad in the results, and select Run as administrator. So open Windows Defender, click Settings, select Excluded files and locations, and then add the hosts file to the exclusion list, which is at: C:\Windows\System32\drivers\etc. This is because Windows Defender will likely detect changes to the hosts file as malicious and revert the changes.
#How to modify hosts file in windows 8 windows 8#
In Windows 8 or 8.1, you must first exclude the hosts file from the scanning of Microsoft’s default antivirus, Windows Defender, if you don’t have a third-party security solution installed. So in Windows 7, click the Start button, type notepad, right-click Notepad in the results, and select Run as administrator. However, you’ll likely have to open the editor with administrative privileges to make edits. You can use a simple text editor, like Notepad, to open and modify the Windows hosts file. This allows you to utilize the hosts file for website redirection, blocking, and filtering. Before querying an external DNS for the IP of the domain name you’re trying to visit, the operating system checks the hosts file for the domain, and if found, the browser gets the content from the IP address of the server that’s indicated. The comments by MSFT in the HOSTS file are all the documentation you really need as far as the HOSTS file itself goes.As you may be aware, Windows and most other operating systems, have a hosts file that essentially acts as an internal domain name system (DNS). You do not even need all the Microsoft comments included in the file, and simple string parsing will do just fine. Once your application is run in administrative mode, its plain text with simple formatting. If they deny it, this example does not run the application.
#How to modify hosts file in windows 8 code#
The below code will request the user for administrative access, the user then has the option to allow or deny it. You can do this through your Program class in your application. First, you should request for administrative permission from the user.