block certain websites: redirect websites

 

When a web page is called up, the domain part of the URL is first converted into an IP address. Responsible for this is the name resolution: DNS. The domain entries contained in the hosts file have priority and are not, as conventionally, queried at the DNS (which IP address has the domain ...).

Due to this fact, it is possible to redirect certain DNS names to another IP address. The hosts file is located at: %systemroot%\system32\drivers\etc\hosts (so mostly: c:\windows\system32\drivers\etc\hosts)

Edit hosts file

The entries can be edited with an editor such as notepad, open the hosts file "as administrator":


In the search field: notepad, on the right "Run as administrator" and open the following file:

c:\windows\system32\drivers\etc\hosts

Redirect web pages

Example entry in the hosts file to block a specific page:
127.0.0.1 blockedwebpage.net

The IP address 127.0.0.1 is always the own computer and all web pages which are stored with this address in the hosts file are not loaded from the internet but answered by the own computer (an error is displayed if there is not a web server running on the computer).
Alternatively, any other IP address could be specified.
Which IP address belongs to which domain can be determined via the command prompt

with the following command

ping www.google.de

can be found out.

If the result of the ping query is used for the entry in the Hosts file, certain pages can be redirected to others.

Hosts file entries are also often used by various spyware to redirect or influence certain web pages. So if you get an error or another web page is loaded when you call a certain web page, it is worth to have a look into the hosts file.

A small detail on the side: the domain microsoft.com cannot be redirected via the hosts file.

Redirect websites and https

Websites that support https and are called with https can only be loaded after confirming a certificate error when redirecting. When using https, the certificate ensures that the page called is actually the page called.

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details