Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using wamp, have all my projects in

E:\webs\*projectname*\htdocs

I want to access all of them in my browser with

http://*projectname*.loc

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

1 Answer 1

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: http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html.

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 127.0.0.1? –  Moak May 11 '10 at 2:30

Your Answer

 
discard

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.