How to Configure Virtual Hosts on XAMPP for WordPress Testing

4
TIPS FOR WEBMASTERS OCTOBER 12, 2012 ROBERT ABELA 2 Comments 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 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. Uncomment the below line to enable name based virtual hosts on your XAMPP. 3. 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 4. 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). 5. By adding the above directives to httpd-vhosts.conf (XAMPP virtual hosts configuration file), the Apache web server running on XAMPP knows that: 1. The website files can be found in c:\xampp\htdocs\wppro (line 2) 2. This website should respond to www.wpwhitesecurity.com (line 3) SUBSCRIBE FOR BLOG UPDATES Enter your email WORDPRESS SERVICES WORDPRESS SECURITY HARDENING WORDPRESS MALWARE REMOVAL WORDPRESS HACK CLEANUP WORDPRESS SECURITY AUDIT WORDPRESS PLUGIN SECURITY CODE AUDIT WORDPRESS ONLINE TRAINING CATEGORIES FROM OUR BLOG TIPS FOR WEBMASTERS UNCATEGORIZED WORDPRESS NEWS WORDPRESS PLUGINS WORDPRESS SECURITY How to run multiple websites on XAMPP on Windows 1 NameVirtualHosts *:80 1 <VirtualHost *> 2 DocumentRoot "C:\XAMPP\htdocs" 3 ServerName localhost 4 </VirtualHost> 1 <VirtualHost *> 2 DocumentRoot "C:\XAMPP\htdocs\wppro" 3 ServerName www.WPWhiteSecurity.com 4 <Directory "C:\XAMPP\htdocs\wppro" > 5 Options Indexes FollowSymLinks Includes ExecCGI 6 Order allow,deny 7 Allow from all 8 </Directory> 9 </VirtualHost> WordPress Security Plugins WordPress Security Services Blog Contact Us

description

Microsoft Dynamics

Transcript of How to Configure Virtual Hosts on XAMPP for WordPress Testing

Page 1: How to Configure Virtual Hosts on XAMPP for WordPress Testing

TIPS FOR WEBMASTERS

OCTOBER 12, 2012

ROBERT ABELA2 Comments

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

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. Uncomment the below line to enable name based virtual hosts on your XAMPP.

3. 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

4. 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).

5. By adding the above directives to httpd-vhosts.conf (XAMPP virtual hosts

configuration file), the Apache web server running on XAMPP knows that:

1. The website files can be found in c:\xampp\htdocs\wppro (line 2)

2. This website should respond to www.wpwhitesecurity.com (line 3)

SUBSCRIBE FOR BLOG UPDATES

Enter your email

WORDPRESS SERVICES

WORDPRESS SECURITY

HARDENING

WORDPRESS MALWARE

REMOVAL

WORDPRESS HACK CLEANUP

WORDPRESS SECURITY AUDIT

WORDPRESS PLUGIN SECURITY

CODE AUDIT

WORDPRESS ONLINE TRAINING

CATEGORIES FROM OUR BLOG

TIPS FOR WEBMASTERS

UNCATEGORIZED

WORDPRESS NEWS

WORDPRESS PLUGINS

WORDPRESS SECURITY

How to run multiple websites onXAMPP on Windows

1 NameVirtualHosts *:80

1 <VirtualHost *>2 DocumentRoot "C:\XAMPP\htdocs"3 ServerName localhost4 </VirtualHost>

1 <VirtualHost *>

2 DocumentRoot "C:\XAMPP\htdocs\wppro"3 ServerName www.WPWhiteSecurity.com4 <Directory "C:\XAMPP\htdocs\wppro">5 Options Indexes FollowSymLinks Includes ExecCGI6 Order allow,deny7 Allow from all8 </Directory>9 </VirtualHost>

Search...WordPress Security Plugins WordPress Security Services Blog Contact Us

Page 2: How to Configure Virtual Hosts on XAMPP for WordPress Testing

3. Allow everyone to access the content of the directory (line 4 to 7)

6. 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:\xampp\apache\bin

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. In my testing environment I have the

following websites set up:

www.WP White Security.com from c:\xampp\htdocs\wppro

www.wphandymen.com from c:\xampp\htdocs\wphandy

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).

WORDPRESS TUTORIALS

ARCHIVES (THE GOOD OLDCONTENT)

Select Month

01 <VirtualHost *>02 DocumentRoot "C:\XAMPP\htdocs"03 ServerName localhost04 </VirtualHost>05 06 <VirtualHost *>07 DocumentRoot "C:\XAMPP\htdocs\wppro"08 ServerName www.WPWhiteSecurity.com09 <Directory "C:\xampp\htdocs\wppro">10 Order allow,deny11 Allow from all12 </Directory>13 </VirtualHost>14 15 <VirtualHost *>16 DocumentRoot "C:\XAMPP\htdocs\wphandy"17 ServerName www.wphandymen.com18 <Directory "C:\xampp\htdocs\wphandy">19 Order allow,deny

Page 3: How to Configure Virtual Hosts on XAMPP for WordPress Testing

Comments

pratik says:

June 18, 2014 at 8:28 pm

Hi,

Thanks for this very nice and informative article!

I have question, after setting up wordpress on XAMPP server, I downloaded

the my live website, and also added eCommerce functionality into it!

It’s running fine on local server which is xampp, which is a virtual host for it!

Now How do I transfer this website running on XAMPP to another virtual

host for which I have the FTP credentials , and that is located at (e.g.)

111.111.11.11 IP adderess.?

Thanks in advance!

Reply

Robert Abela says:

June 29, 2014 at 11:57 am

Hi Pratik,

Thank you for following us. To transfer a website from XAMPP to the

live server, or from any other source you should do a normal

WordPress backup on XAMPP and restore it on the Live server. If you

are new to WordPress backup here is a list of articles we have related

to WordPress backup: http://www.wpwhitesecurity.com/tag/wordpress-

backup/.

Reply

20 Allow from all21 </Directory>22 </VirtualHost>

Share Share Share Share Share

How and why to use Windows Hosts file

htpasswd tutorial | How to create an Apache password file

Generate a Self Signed SSL Certificate for HTTPS on Apache

Related Posts:

TAGS: blogger tips, webmaster tips, wordpress testing, xampp, xampp configuration

Page 4: How to Configure Virtual Hosts on XAMPP for WordPress Testing

Is your WordPress Hacker Proof?WP White Security specializes in WordPress security services such as malware

removal, security hardening and security audits. For more information about

our services, refer to our Security Services page.

Security Services

Tel: +44 20 3588 0327

Speak Your Mind

Name *

Email *

Website

Post Comment

GETTING STARTED WITH WORDPRESS

Why Choose WordPress?

Definitive guide to htaccess & WordPress

Definitive Guide to WordPress SSL

All about WordPress Plugins

All about WordPress Themes

LATEST FROM OUR BLOG

Why are Google Using HTTPS for Website Ranking?

Monitor Custom Fields Activity in WordPress Posts, Pages and Custom

Post Types

Is WordPress Secure?

Enhanced Monitoring of WordPress Failed Logins with WP Security Audit

Log Plugin

WP Security Audit Log Improved Support for High Traffic WordPress

Websites

© Copyright 2014 · WPWhiteSecurity.com · All Rights Reserved · Privacy Policy· Site Hosted by SiteGround TwitterFacebookLinkedinGoogle PlusRSS