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.
You can use mod_vhost_alias to dynamically set your DocumentRoot. For example:
%-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.