During web development, sometime you (I always) need to test with a domain name, whether inside local computer or online. This post will tell you how to run multiple domain on your local PC, without setting up a DNS server. I am using Apache 2.0.53.
Case: You want to develop a website for your-domain.com and need to test it online under certain domain name.
 Create a local domain name
To differ between online and local domain, you need to create a local domain name (sub domain is okay), i.e: local.yourdomain.com
 Edit your hosts file
In Windows XP, the “hosts” file can be found at “C:\WINDOWS\system32\drivers\etc”. Put your local domain/subdomain there with the following order:
 Add a Virtual Host into your apache configuration file (httpd.conf)
ServerAdmin [email protected]
CustomLog logs/local.yourdomain-access_log common
Point your web browser to http://local.yourdomain.com. I have a result like this.
From now on, you can run multiple domain on your local PC, without the need to install DNS server.
Questions are welcome. Just leave it here and I am ready to help you.