How to add websites to HOSTS file

Hi there,

Regarding the use of the HOSTS file in Windows 7 to block ads and unwanted tracking cookies:

I would like to block everything and anything from the server. I understand that I could add these lines to the HOSTS file:


How can I use a single line to block all contents from the domain? (ie *

I have tried using * AND
but it does not work.

Another example is that I would like to block all contents from, including, etc.


Unfortunately, wildcards are not allowed in the hosts file and neither are domain separators such as / \ etc. If you want to use the hosts file for ad blocking, you can add up to 9 entries per line. For example: etc.

Thanks Radaghast for your answer.