Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using wamp, have all my projects in


I want to access all of them in my browser with


is there a way i can set up hosts and vhosts files so i never have to open them again?

note this is for my own personal use, and I can change from .loc to .whatever if ICANN decides to start selling .loc domains.

share|improve this question
up vote 2 down vote accepted

You can use mod_vhost_alias to dynamically set your DocumentRoot. For example:

VirtualDocumentRoot e:/webs/%-2/htdocs

%-2 Is a placeholder for the second last part of the hostname. Other examples are available in the mod_vhost_alias documentation:

Regarding the hosts file, it isn't possible to use wildcards in the hosts file. One option is to install a local DNS server and add a zone for local use and create the wildcard record in this zone. A very basic DNS server for Windows would do the job, I'm not a Windows guy so I can't help you with what software to use.

Another option would be to use an online registered domain by creating a wildcard record in the DNS zone pointing to your local IP address. Another advantage of using an official domain is you don't have to change the DNS server on all clients.

share|improve this answer
50%! what about the dynamic hosts file or how to make all .loc /.dev or whatever direct to – Moak May 11 '10 at 2:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.