If you are a WordPress plugin or WordPress theme developer, or provide professional WordPress support from time to time you need to run multiple WordPress websites on the same XAMPP installation on Windows. Multiple websites running on the same Apache web server are called Virtual Hosts. In this easy to follow tutorial we explain how to setup multiple virtual hosts on XAMPP so you can run multiple WordPress websites on the same XAMPP installation.
Configure Virtual Hosts in XAMPP
- How can i view my app from another device (mobile) – Akash Jul 1 '14 at 15:11 Then you will need a home server, this is not possible with xampp. You could use a raspberry pi for this, if it is for your own usage only.
- XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl.
XAMPP is a complete web, database and FTP server package for Windows that's ready to go in minutes and completely portable. The full XAMPP package includes: Apache; MySQL; PHP + PEAR; MiniPerl; OpenSSL; phpMyAdmin; XAMPP Control Panel; Webalizer; Mercury Mail Transport System; FileZilla FTP Server; SQLite; ADODB; Zend Optimizer; XAMPP Security; Tomcat.
- 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:xamppapacheconfextra
- Uncomment the below line to enable name based virtual hosts on your XAMPP.
- At the end of the file add the following 4 lines. These 4 lines are used to allow access to the XAMPP configuration pages (to access phpMyAdmin etc) by using the URL http://localhost
- For each other virtual host (website) you would like to configure on the XAMPP Apache web server, add the below code (using www.wpwhitesecurity.com as example).
- By adding the above directives to httpd-vhosts.conf (XAMPP virtual hosts configuration file), the Apache web server running on XAMPP knows that:
- The website files can be found in c:xampphtdocswppro (line 2)
- This website should respond to www.wpwhitesecurity.com (line 3)
- Allow everyone to access the content of the directory (line 4 to 7)
- To test and confirm that all the syntax in the Apache configuration is correct, run the httpd.exe process with the –t switch from the c:xamppapachebin directory as seen in the below screenshot.
Configure the Windows Hosts File
Use the Windows Hosts file to redirect the traffic from your computer to the local installation of XAMPP rather than to the original website. E.g. while testing new WordPress changes for our website WP White Security.com, I add an entry in the Windows Hosts file to redirect requests from my browser to the local intallation of XAMPP. To learn on how to redirect traffic using Windows Hosts file, read our webmaster tip Configuring Windows Host Files.
Configuration example: Running multiple websites on XAMPP
If you would like to add more than one virtual host (website) to XAMPP, simple add more VirtualHost directives to the same file. Jiffy lube brake prices. In my testing environment I have the following websites set up:
- www.WP White Security.com from c:xampphtdocswppro
- www.wphandymen.com from c:xampphtdocswphandy
To have both websites and the XAMPP configuration pages (localhost) running on my XAMPP installation, I have the following in the XAMPP virtual hosts configuration file (httpd-vhosts.conf).