Since setting up my development environments on Mac OS X Lion (brand new macbook air purchased in January 2012), I have noticed that resolving to a virtual host is very slow (around 3 seconds) the first time but after that is fast as long as I continue loading it regularly.

If I leave it untouched for a couple of minutes and then reload again, the first reload is (again) painfully slow; seems like something is being cached. 

As can be seen below I am not using the .local TLD.

My setup: Apache 2 - MySQL - PHP installed and enabled - added a couple of virtual hosts one of which I created for localhost

My /etc/hosts:

```
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
127.0.0.1       myproject.dev
::1             myproject.dev
fe80::1%lo0     myproject.dev

```

My virtual host set-up in username.conf: 

```
NameVirtualHost *:80

<Directory "/Users/myusername/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /Users/myusername/Dropbox/dev_envs/
</VirtualHost>
<VirtualHost *:80>
    ServerName myproject.dev
    DocumentRoot /Users/myusername/Dropbox/dev_envs/myprojectname
</VirtualHost>

```
['https://Stackoverflow.com/questions/10064581', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/61232/']
On OSX El Capitan what worked for me was making a duplicate IPv6 entry right above the IPv4 entry like so

```
fe80::1%lo0 demo.test.dev
127.0.0.1   demo.test.dev

```
Note: I am using Windows and XAMPP, however while researching the problem many people have had the same issue on Windows and Mac. Answer for reference for anyone finding this question as I have spent hours trying to find a solution that works for me:

I have tried many solutions for the same problem including putting all of the hosts on one line, removing redundant hosts and virtualhosts, and also including the IPv6 lines - none of these *alone* were successful. 

The only solution which has *so far* appeared to work for me is a combination of all of the solutions:

* Changing the domain I am using from mysite.**local** to mysite.**dev**. Inspired by [@Cleverlemming's answer.](https://stackoverflow.com/a/17982964/1588706)
* Including the IPv6 lines.
* Removing redundant virtualhosts and hosts (I commented them out).

In my hosts file my hosts are currently on separate lines and so far the issue seems to be fixed.

Good luck to anyone attempting to solve this issue and if anyone has any information to add please do so - this seems to be an issue affected a lot of people with no single known cause or solution.