Out of the box XAMPP only displays a single website, which is located in the htdocs directory. If needed, multiple websites can be served by implementing virtual hosts, which only requires editing 2 files. If you’ve been working with another type of server and have not been able to figure this out, don’t worry because it’s really easy.
In the <xampp>/apache/conf/extra directory, you will find a file named http-vhosts.conf. Lets say we want to add a domain named example and that it will be located at C:\xampp183\htdocs\example, here’s what we add to the conf file:
<VirtualHost *:80> ServerName example DocumentRoot "C:\xampp183\htdocs\example" </VirtualHost> <VirtualHost *:443> DocumentRoot "C:\xampp183\htdocs\example" ServerName example SSLEngine on SSLCertificateFile conf/ssl.crt/server.crt SSLCertificateKeyFile conf/ssl.key/server.key </VirtualHost>
We also need to tell your computer to route any request for the example domain to localhost (127.0.0.1), so we need to edit the hosts file. My hosts file is located at C:\Windows\System32\drivers\etc. At the bottom of the hosts file, we just add the following line:
You can’t edit this file correctly unless you run Notepad as an administrator. To do that you simply right click on your Notepad icon and select “Run as Administrator”.
When you add a domain, you need to restart Apache if it was running. Restart, and then you should be able to access your new domain, http://example‘, ‘Virtual Hosts in XAMPP on Windows 7 64-bit