There are more then one tutorial on the internet on how to configure Xampp to run more then one domain. So far I could not find one that told the complete story. So here it is:
1) In the folder where your Xampp is installed is a folder locate called apache. That folder has a subfolder called ‘conf’ which has ha subfolder called extra. In that last subfolder you will find a file called httpd-vhosts.conf
Open that file in a text editor and
a) enable the virtual host ability by uncommenting line 20 (removing the ‘#’ in that line).
b) Add the virtual hosts code to the bottom of that same file. (You will find the code used below in the Toggle (+ sign)). Note i have my Xampp server installed in drive D:\xampp. Make sure you adjust that path when you grab the code snippet below.
Now what you need to add is this code to keep the Xampp control panel alive is this:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot D:/xampp/htdocs
ServerName localhost
<Directory "D:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Then for each domain you want to run on your server add this code (change the yourdomain.com to the correct domain name. I used wp.dev and wpempty.dev in my code examples).
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot D:/xampp/htdocs/yourdomain.com
ServerName yourdomain.com
ServerAlias www.yourdomain.com *.yourdomain.com
ErrorLog "logs/yourdomain.com-error.log"
CustomLog "logs/yourdomain.com-access.log" common
<Directory "D:/xampp/htdocs/yourdomain.com">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Click on the plus sign for 'The Code Used'
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot D:/xampp/htdocs
ServerName localhost
<Directory "D:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot D:/xampp/htdocs/wp.dev
ServerName wp.dev
ServerAlias www.wp.dev *.wp.dev
ErrorLog "logs/wp.dev-error.log"
CustomLog "logs/wp.dev-access.log" common
<Directory "D:/xampp/htdocs/wp.dev">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot D:/xampp/htdocs/wpempty.dev
ServerName wpempty.dev
ServerAlias www.wpempty.dev *.wpempty.dev
ErrorLog "logs/wpempty.dev-error.log"
CustomLog "logs/wpempty.dev-access.log" common
<Directory "D:/xampp/htdocs/wpempty.dev">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Save the file.
2) Change the windows host file. Now in order to be able to call the website in your web browser you need to adjust the host file of your windows install. The file can be located in C:\windows\system32\drivers\etc
Note : if your windows is not installed on the C-drive change the c:\ into the correct drive letter of your install.
Add, in this case as i have created two virtual servers, two lines
127.0.0.1 wp.dev
127.0.0.1 wpempty.dev
3) now Stop the Apache server and restart it again in the Xampp controll panel.
4) install your wordpress or whatever website cms in those folders.
5) Open the browser and just type in http://wp.dev or http://wpdempty.dev
If all has been setup correctly you will see the website wordpress install or website cms system you installed.