Hamsa K
3 min read | 5 years ago

Configure Virtual Hosts in Xampp

Configure Virtual Hosts in Xampp

Configure Virtual Hosts in Xampp
1. To add virtual hosts in XAMPP, or in other words, to configure multiple websites on XAMPP, open the Virtual Hosts Apache configuration file httpd-vhosts.conf  from C:\xampp\apache\conf\extra\
2. Update "C:\xampp\apache\conf\extra\httpd-vhosts.conf" add new virtual host config.

<VirtualHost localhost.example:80>
DocumentRoot "C:/xampp/htdocs/example/public"
ServerName localhost.example
ServerAlias localhost.example
<Directory "C:/xampp/htdocs/example/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all Granted
Order allow,deny
Allow from all

Configure the Windows Hosts File
Add entries to Windows Hosts file
1. The Windows Host file is called hosts (without any file extension) and can be found in the following directory: C:\Windows\System32\drivers\etc\
2. To open the file, right click it and select ‘Open with’ option from the right click menu.

4. To redirect all the traffic from your computer to your website to the test website on XAMPP web server running on your own computer, add the following line at the end of the hosts file:

#       localhost.example 
# ::1             localhost.example

5. Restart Apache and test everything.

Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy