Im wanting to set up my local xampp server in a particular way. For each individual project i create in my document root, i want to be able to access it via http://projectname.localhost. How do i go about doing this with virtual hosts. Do i need to edit windows host file for every new project i create?


Yes, you will need to edit the windows host file for every new project. The windows host file does not allow wildcard subdomains. If it is very important to you, you can run your own DNS server and setup TCP/IP to use for DNS.

You can use mod_vhost_alias to configure the virtual host in Apache dynamically. Something like...

  ServerAlias *.localhost
  UseCanonicalName Off    
  VirtualDocumentRoot C:/xampp/htdocs/%1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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