Why ?
Because it’s nicer, handier and sometimes just plain necessary to refer to ‘test-sites’ on your development machine as http://project instead of http://localhost/project. (first time I needed it was when breaking my head over mod_rewrite)

I’m still running a Fedore Core 3 Linux installation here, but I guess this will be the same on 90% of standard Linux installations.

How ?
Add the fake domain to /etc/hosts, so your computer knows the ip addres (=local) and doesn’t need to query dns (which won’t work).
Also change apache httpd.conf to add the domain and the corresponding ‘root path’.

Add the domain to /etc/hosts
Add the domain to your /etc/hosts file, either as a new domain pointing to your local ip (, or as an alias to your machine’s entry that’s already in there. Look for the following line (there’s probably only one in there): localhost.localdomain localhost

Now add your ‘test’ domain, let’s call this one ‘project’: localhost.localdomain localhost project

Now ‘ping project’ and you’ll see the ping going to NO REBOOT NEEDED (only a save ofcourse), this isn’t windows!

Change Apache httpd.conf
Next, we need to add the virtual domain to apache’s config file, which is located at /etc/httpd/conf/httpd.conf (on FC3, otherwise ‘find’ it). At the end of httpd.conf, add the following (let’s pretend the root of our domain is located at /var/www/html/project on the filesystem):

<virtualhost *:80>
DocumentRoot /var/www/html/project
ServerName project

Use ‘service httpd restart’ to restart Apache with the new config. (if this doesn’t work, try ‘httpd -k restart’)
Open a browser, surf to’ http://project’ => bingo!

Running Windows ?
I haven’t tested this, but I guess instead of adding your domain to /etc/hosts, you’ll need to find a file called ‘lmhosts’ (no extension!) and add your domain pointing to there. I *think* the apache httpd.conf modification will be the same.