title: XAMPP virtual hosts not recognized - goes to online search
body: <p>I am developing a Wordpress site locally on my computer. I have two installations of Wordpress, one is inside <strong>C:\xampp\htdocs\wordpress</strong> and the other one is in <strong>C:\My_Sites\medicalproject\wordpress</strong></p>
  
  <p>I have XAMPP installed and I access the first installation by typing <strong>localhost/wordpress</strong>. For the second I had created a virtual host named <strong>medicalproject</strong> and to access that I simply opened my browser and typed <strong>medicalproject</strong>.</p>
  
  <p>All was going well until I tried to create another host for testing purposes. I saw that it wasn't working so I deleted the new virtual host and was left with the <em>medicalproject</em> one only. But the problem is not solved. What happens is that the browsers (FF, IE, Chrome, Opera) do not recognize <em>medicalproject</em> and run a google search instead. Apache starts normally and I can access both <em>localhost</em> and <em>localhost/wordpress</em> which is the first installation.</p>
  
  <p>I mention that when I was trying to add the second virtual host Avira Free Antivirus blocked access to the hosts file where you have to add the loopback IP for local hosts (127.0.0.1 and the name of the server). I disabled that feature, restarted several times and tried but no luck.</p>
  
  <p>Below is how my httpd-vhosts.conf looks like. I mention that this exact configuration was working before.</p>
  
  <pre><code>## Virtual Hosts
  #
  # If you want to maintain multiple domains/hostnames on your
  # machine you can setup VirtualHost containers for them. Most configurations
  # use only name-based virtual hosts so the server doesn't need to worry about
  # IP addresses. This is indicated by the asterisks in the directives below.
  #
  # Please see the documentation at 
  # &lt;URL:http://httpd.apache.org/docs/2.2/vhosts/&gt;
  # for further details before you try to setup virtual hosts.
  #
  # You may use the command line option '-S' to verify your virtual host
  # configuration.
  
  #
  # Use name-based virtual hosting.
  #
  NameVirtualHost *:80
  
  #
  # VirtualHost example:
  # Almost any Apache directive may go into a VirtualHost container.
  # The first VirtualHost section is used for all requests that do not
  # match a ServerName or ServerAlias in any &lt;VirtualHost&gt; block.
  #
  ##&lt;VirtualHost *:80&gt;
      ##ServerAdmin postmaster@dummy-host.localhost
      ##DocumentRoot "C:/xampp/htdocs/dummy-host.localhost"
      ##ServerName dummy-host.localhost
      ##ServerAlias www.dummy-host.localhost
      ##ErrorLog "logs/dummy-host.localhost-error.log"
      ##CustomLog "logs/dummy-host.localhost-access.log" combined
  ##&lt;/VirtualHost&gt;
  
  ##&lt;VirtualHost *:80&gt;
      ##ServerAdmin postmaster@dummy-host2.localhost
      ##DocumentRoot "C:/xampp/htdocs/dummy-host2.localhost"
      ##ServerName dummy-host2.localhost
      ##ServerAlias www.dummy-host2.localhost
      ##ErrorLog "logs/dummy-host2.localhost-error.log"
      ##CustomLog "logs/dummy-host2.localhost-access.log" combined
  ##&lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
      DocumentRoot "C:/xampp/htdocs"
      Servername localhost
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
      DocumentRoot "C:\My_Sites\medicalproject\wordpress"
      ServerName medicalproject
      ErrorLog "C:\My_Sites\medicalproject\medicalproject.error.log"
      CustomLog "C:\My_Sites\medicalproject\medicalproject.access.log" combined
    &lt;Directory "C:\My_Sites\medicalproject\wordpress"&gt;
      Order allow,deny
      Allow from all
    &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>