Ads are annoying on the web. Besides they lower your internet bandwidth and can be particularly offensive for minors. If you share your PC with your kids, I’m sure you will see how helpful my advice is. There are different ways to screen advertising with use of free and paid DNS providers, firewalls, and special software. I propose to use light and effective method of modifying hosts file. It is a manual hack, but if you browse approximately the same list of websites every day, it will not be very tedious to implement. I’ll explain in plain and simple language. This method is not risky and very easy to revert, if for whatever reason something goes wrong. I tried it in Windows 7, 8, and 10 Technical Preview. It does not matter whether you use 32 or 64 bit version, it will work anyway.
1. Get the HOSTS file
First look for the following path in the Windows Explorer:C:\windows\system32\drivers\etc
To be on a safe side, make a backup of this file, save a copy of it in a different folder. This file has no extension ‘naturally’, so don’t worry. So, you can copy it to your Document folder, for instance, and make another copy with extension .bak. Then leave the file hosts.bak intact. And double click the file hosts in this new location. We will edit this file here, and once you are done, you will copy the edited new file back to the target place (C:\windows\system32\drivers\etc) to replace the original file. It is because we cannot edit this file directly in its original place.
When you double click the file, you have to choose which program to use to edit it. Pick NOTEPAD. Then you will see something similar:
Everything except the last line (127.0.0.1 localhost) is simply a commented description. You need to extend the list to assign the web addresses you want to block to this IP address 127.0.0.1. For example:127.0.0.1 cdn1.clkads.com
What it does, it tells to the system, if that exact address is requested (e.g. cdn1.clkads.com) then instead of getting the real IP address from the root server (DNS), it will immediately short cut it to the 127.0.0.1, which is zero content. It applies to every web browser you can use — Internet Explorer, Chrome, Opera, Firefox, you name it.
Mind the syntax though: don’t put http:// or https:// — not needed.
2. How to block the ads.
So, how to hit particular ads you see every time you visit certain websites?
Let’s take this example:
Right-click on the image which gives an advertising and spot the image address (URL):
So, in this case you should add to the hosts file the following line:
Notice that if you simply enter smi2.net, it will not work for this picture. Hosts file needs EXACT address to be indicated before the first slash.
Another case is FLASH ads. Sometimes, you just need to search inside the source file for the web page. Look for ad blocks. For example, there are two here:
Add these two lines to the host file and save it:127.0.0.1 ads.adfox.ru
Now lets try it. Copy the modified file to the C:\windows\system32\drivers\etc and restart the web browser. Go to the same page. You may need to reload or clean the cash to see the effect:
Here we go, no annoying picture anymore!
You may ask how long the hosts filter list can be to avoid overloading the system. I have no reason or proof to state that long lists affect the browsing performance in some way. I’ve seen lists long enough.
3. Final important remark.
Some antivirus software will detect your activity as a malicious one (it is because sometimes malware uses this method to reroute you from legitimate sites to ones infected). In this case just add your newly modified file to the exceptions, like in the screenshot below for Windows Defender: