I want to setup my local development machine so that any requests for *.local
are redirected to localhost
. The idea is that as I develop multiple sites, I can just add vhosts to Apache called site1.local
, site2.local
etc, and have them all resolve to localhost
, while Apache serves a different site accordingly.
I am on Windows XP.
I tried adding
127.0.0.1 *.local
to my c:\windows\system32\drivers\etc\hosts
file, also tried:
127.0.0.1 .local
Neither of which seem to work.
I know I can set them up on different port numbers, but that is a pain since it is hard to remember which port is which.
I don't want to have to setup a local DNS server or anything hard, any suggestions?
Acrylic DNS Proxy (free, open source) does the job. It creates a proxy DNS server (on your own computer) with its own hosts file. The hosts file accepts wildcards.
Download from the offical website
http://mayakron.altervista.org/support/browse.php?path=Acrylic&name=Home
To configure Acrylic DNS Proxy, install it from the above link then go to:
Add the folowing lines on the end of the file:
127.0.0.1 *.localhost
127.0.0.1 *.local
127.0.0.1 *.lc
Restart the Acrylic DNS Proxy service:
You will also need to adjust your DNS setting in you network interface settings:
Set "Use the following DNS server address":
Preferred DNS Server: 127.0.0.1
If you then combine this answer with jeremyasnyder's answer (using VirtualDocumentRoot
) you can then automatically setup domains/virtual hosts by simply creating a directory.