Configuring a WordPress Subdomain Multisite on Windows Localhost

The following explains how to install and configure a subdomain-based multisite on a local Windows machine. Note that Linux and MacOS would be very similar although the paths to files are a bit different.

Example

In this example we will be installing a multisite to be hosted on localhost with XAMPP using an alias of ‘ms-subdom.loc’, with three subsites in total: ms-subdom.loc, one.ms-subdom.loc and two.ms-subdom.loc. In the example, XAMPP is installed to c:\xampp.

Substitute values of your own directories and subdomains.

  1. Add the following to c:\Windows\System32\drivers\etc\hosts: 127.0.0.1 ms-subdom.loc 127.0.0.1 one.ms-subdom.loc 127.0.0.1 two.ms-subdom.loc
  2. Add the following to c:\xampp\apache\conf\extra\httpd.vhosts.conf <VirtualHost *:80> DocumentRoot "D:/webroot/ms-subdom.loc" ServerName ms-subdom.loc </VirtualHost> <VirtualHost *:80> DocumentRoot "D:/webroot/ms-subdom.loc" ServerName one.ms-subdom.loc </VirtualHost> <VirtualHost *:80> DocumentRoot "D:/webroot/ms-subdom.loc" ServerName two.ms-subdom.loc </VirtualHost>
  3. Install WordPress (browse to http://ms-subdom.loc when installing)
  4. Convert the site just installed to a multisite as explained here.
  5. Login to http://ms-subdom.loc/wp-admin using the Network Admin user
  6. Go to My Sites > Network Admin > Sites and add sites one-ms-subdom.loc and two.ms-subdom.loc

After performing the above steps, you should be able to properly access http://ms-subdom.loc, http://two.mssubdom.loc and http://three.mssubdom.loc.

About The Author