Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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 127.0.0.1 for DNS.

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

<VirtualHost 127.0.0.1:80>
  ServerAlias *.localhost
  UseCanonicalName Off    
  VirtualDocumentRoot C:/xampp/htdocs/%1
</VirtualHost>
share|improve this answer
add comment

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.