Managing local hosts on Windows XP

The first thing to do is to locate the host file, which is typically under /windows/system32/drivers/etc. Usually this file contains the following line by default:    localhost

Then you can add the name of your local host, which must correspond to a physical directory on your PC:    localhost    yoursite

It doesn't matter whether you use "yoursite" or "" or even "": the important thing is that this name must correspond to a real directory. Done this, you can create a directory structure inside this folder, for example yoursite/htdocs and add a VirtualHost directive in Apache's httpd.conf file by also setting the DocumentRoot directive to a directory of your choice (in this case you can choose htdocs).

Note how the IP trick works: the last number on the right has been incremented by 1 (, so you can add many other hosts to the host file. Always remember to edit the configuration file of Apache or, even better, use a custom .htaccess file.

Leave a Reply

Note: Only a member of this blog may post a comment.