You have two options to test sites that use multiple subdomains:
- Add each and every subdomain to your host file
- Setup a DNS server (Dnsmasq or Bind)
Both these approaches have their disadvantages. Updating your hosts file can become tedious, especially if your site supports dynamic subdomain creation. And setting up a DNS server takes some effort.
Tim Pope found a simple workaround for this problem. As he mentions here:
“I grabbed smackaho.st and made it a localhost wildcard, pointing *.smackaho.st at 127.0.0.1″
One issue remains: say my development box is at 192.168.0.100 in my home network and my Droid is at 192.168.0.110, how would I be able to access the sites on my Droid? One way is to update the hosts file on the Droid, but you need root access for that.
So I grabbed dm7.me and made it point to my dev machine’s local ip address: *.dm7.me points to 192.168.0.100. Now I can access my development sites from all the devices on my network without having to update the hosts file on each and every one of them.