Topic : How to block any website or redirect any website in window PC:

Introduction to command prompt: InfoBrother

How to Block any website or redirect any website in window PC.

There are many reasons to block certain websites to be accessible from our browser. Maybe we don't want our kids to access some naughty website. Just telling them to stop opening them wouldn't be a great solution. we must do something so our kids can't open these websites. We are here to learn how to block any website manually by just changing certain settings on our system.




Basic Concept - Host file.

Before we proceed, Let's introduceWindows Host File.. The windows host file is a file that windows use to control and map IP addresses. The hostnames connected to a network needs to be mapped to their corresponding IP addresses. This is done so to uniquely identify a particular system in a pool of systems connected to the internet. This windows Host file is responsible for providing this mapping function. Slight Modifications made to this file can help us to block any website.


Open Hosts file.

How to block any website in window PC - InfoBrother

    1 » Press start button and search for Notepad and run it as administrator.
    2 » Click file and select open.

How to block any website in window PC - InfoBrother

    3 » Windows explorer will open, then navigate to C: » Windows » System32 » drivers » etc.
    4 » Select "All files" from drop down list.
    5 » Double click at hosts file to open it.

NOTE: If window is not installed on C: drive, then change the drive letter in step # 3.


Edit Host file to Block website.

How to block any website in window PC - InfoBrother

Blocking a website in windows is very simple. We use the following format to block the website.

System IP-Address   website-url

For example, if we want to block YouTube in our system. we can write the command as-

In above command we just tell windows that the website "" should redirect to the IP address, which is just the loopback address on our local system. If we don't have a local website setup on our system. we will just get an error page in our web browser.


How to redirect a website to another website?

Using host file, we can redirect a website to another website. by just replacing the Local IP address with website IP address, we can redirect any website to another website. In order to do this - follow the given steps.

How to block any website in window PC - InfoBrother

Open a command prompt (press start and type cmd) and type the following command and press enter. This command will get you the IP address of the selected website.

ping website-url

How to block any website in window PC - InfoBrother

Now in Host file, replace the local IP address with the website IP address. This Will tell system to redirect the to the

You like it? Other May like it too:


I Tried my Best to Provide you complete Information regarding this topic in very easy and conceptual way. but still if you have any Problem to understand this topic, or do you have any Questions, Feel Free to Ask Question. i'll do my best to Provide you what you need.

Sardar Omar.