Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 have XAMPP running on my desktop machine, and I do all my work on it with no issue.

http://localhost       ---> points to public_html
http://site1.localhost ---> points to site 1
http://site2.localhost ---> points to site 2
http://site3.localhost ---> points to site 3

Entering the above URLs in my web browser on the machine with Apache works great, and I can work on multiple sites within distinct subdomains.

But what I want to do now is to transfer Apache and all the files to another Windows 7 machine within the LAN, but still be able to view the subdomains from my main development machine.

With a vanilla XAMPP installation on the new hosting machine, entering the IP address of that machine (e.g. into my development computer would send me to the main public_html folder.

But how do I set up subdomains such that I can access it externally? For example, http://site1.devmachine

Thanks for any help.

share|improve this question

edit %systemroot%/system32/drivers/etc/hosts of your workstation and add: site1.devmachine site2.devmachine

What this will do is resolve site2.devmachine to the IP address of your new dev server. Because you're sending along the host headers to the dev server when you make a request, Apache knows what virtual host to load.

Just so you know, .devmachine can be anything: you could even put realdomain.tld in there (although I don't recommend this; I found I'd forget about it and wonder why the site looked "old").

I found it easier to setup a wildcard in DNSMasq and do split DNS so that when I'm on my LAN, I can pull up the same site as when I'm accessing it remotely (I use *, * being replaced by client name; I also have the same wildcard entry for my real Internet DNS servers) at a client's doing a demo. Now when I want to setup a new site to work on, I just have to create a new virtual host in Apache and not worry about DNS.

share|improve this answer
Oh, so in the same way I edit the hosts file on my host machine, I can do exactly the same on my client machine, and it will resolve correctly? Cool, thanks. – RC Apr 19 '10 at 22:49
Yup, before I setup a DNS server at home, I used to put all my project sites ( etc.) in my dev machine's hosts file but eventually I setup DNSMasq on my Ubuntu dev server with a wildcard entry so that I didn't have to edit the hosts file anymore. – gravyface Apr 19 '10 at 22:54
+1, This is how i've always done it – GruffTech Apr 19 '10 at 22:56

Add a DNS server to your network and create entries for site1.devmachine.local etc.

Get your dev machine to use this DNS server.

That might be overkill though. You could more easily add entries to the hosts file in c:\WINDOWS\system32\drivers\etc. This is on your devmachine only.

Add entries like this: site1.devmachine.local site2.devmachine.local site3.devmachine.local

share|improve this answer

Your Answer


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