XAMPP provides a full blown Linux Apache MySQL server installation and is a very good way to seup LAMP architecture on your Windows PCs. Although, XAMPP is available for Linux distribution as well, but is not used often as LAMP packages are readily available on Linux distributions.
In this article we will talk about how to set-up Multiple Websites in XAMPP or any Apache Server. "Multiple Websites" would be the common term for the much appropriate technical term - "VirtualHosts" or "NameVirtualHosts".
We will work through this tutorial based on a real life example. Lets assume we have to work on two development web-based projects on the same apache server - http://project1.dev and http://project2.dev. Also, we are assuming that you have installed xampp in this directory: C:/xampp
Step 1 - After you have successfully installed XAMPP on your Windows system, open the file:
This file is your VirtualHosts configuration file and will be referred to in all forthcoming steps.
Step 2 - At around Line number 19, you can find a commented out line that goes like this:
Please make sure that you un-comment this line
Step 3 - Add the first VirtualHost directive for your localhost so that urls like http://localhost or http://127.0.0.1 are still accessible. This is an extremely necessary step and make sure you add this to the VirtualHosts configuration file else you will lose access to the http://localhost.
Step 4 - Now start adding the directives for your two development project websites:
CustomLog "logs/project1.dev-access.log" combined
CustomLog "logs/project2.dev-access.log" combined
We are now set all you have to do is just restart your Apache server and you can star accessing the sites at: http://project1.dev and http://project2.dev