Windows 'hosts' file ignored: solution

Author: Razvan MIHAIU (please remove '_rem' and 'rem_')
Date: 11/04/2005

Today I lost 1 hour trying to understand why the settings from my 'hosts' file were ignored on a 'Windows 2000' machine. When I was faced with this problem I tried the following but without success:

  1. to use to tabs instead of empty spaces and vice-versa. I tried both variants. I later found out that on 'Windows 2000' this file is not sensible to 'tab' vs. 'empty spaces' issue.
  2. too many entries in the 'hosts' file. This was not the case: this file can support several hundreds entries and I only had about 10 entries. However, if you have too many entries in the 'hosts' file your PC's performance may be drastically degraded.

  3. maybe a reboot is required after each modification in order to be acknowledged by the system. This is false: no reboot is required if new entries are added to an already functional 'hosts' file. The web browser needs to be restarted in order to use the new settings.

The solution to this problem is not found in the file itself but in the registry. The registry key


points to the location of the 'hosts' file. Since some program from my workstation has altered this registry key, the default hosts file was completely ignored. If you will find the same situation on your machine it is possible that some Adware/Spyware has been installed on your machine. This kind of application will attempt to disable the 'hosts' file because some people use this file in order to cancel all the connections to some hosts with bad reputation.

How to enable the hosts file (step by step)

  1. run 'regedit':
    run windows regedit

  2. when first started, regedit look like this:

    picture of windows regedit when first started

  3. navigate to the above mentioned key:

    navigate windows regedit


    • check that you are truly in the right position in the registry - the status line from your regedit window shows you the current position. In the picture this is marked as "1".
    • search for the "DataBasePath" key in the right panel. In the picture this is marked as "2".

  4. Store in the key "DataBasePath" to the path where you intend to put your 'hosts' file. For 'Windows 2000' the default file location is:


    save regedit key DataBasePath

  5. Reboot the machine. This is necessary only when the path to the 'hosts' file is updated (e.g. registry settings are changed), not when the hosts file itself is updated.

All the above information can be found on Microsoft's web site.

This is a big file: finding the useful information took me about 1 hour. If you are a real geek you are welcome to take a look by yourself :). Search for the word "DataBasePath" in order to find the relevant section.


Ad blocking using the windows host file seems to be very easy to circumvent because any program can modify the registry settings (this is possible because the majority of windows users are running their PCs in administrator mode)

Best regards,

Razvan Mihaiu � 2000 - 2023